View index.php
try {
// send email
}
catch (Swift_TransportException $e) {
// delete email
}
View yii2_search_sphinx.php
public function actionSearch()
{
// ---------SphinxSearch----------
if($_SERVER['REQUEST_METHOD'] == 'GET')
{
$searchText = HtmlPurifier::process(Yii::$app->request->get('search'));
$searchText = trim($searchText);
$sphinxQuery = new Query();
$sphinxResult = $sphinxQuery->from('post_index')->match($searchText)->all();
View php_decrypt_encrypt.php
$key = 'password to (en/de)crypt';
$string = ' string to be encrypted '; // данные для шифровки/дешифровки
/////////////// Шифрование //////////////////
$iv = mcrypt_create_iv(
mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC),
MCRYPT_DEV_URANDOM
);
$encrypted = base64_encode(
View foreffactory.php
<?php
include_once('simple_html_dom.php');
// %progdir%\modules\wget\bin\wget.exe -q --no-cache http://forexfactory.loc/forexfactory.php
define ("PATH_TO_FOLDER", "C:/Users/Vadim/AppData/Roaming/MetaQuotes/Terminal/D0E8209F77C8CF37AD8BF550E51FF075/MQL5/Files/");
// define ("PATH_TO_FOLDER", "E:/openserver522/openserver/domains/forexfactory.loc/");
define ("CSV_FILE_NAME", "forexfactoryparce.csv");
if(!file_exists(PATH_TO_FOLDER.CSV_FILE_NAME))
View gist:9f93f8de3e6a9ff2afdd
<?php
include_once('simple_html_dom.php');
// %progdir%\modules\wget\bin\wget.exe -q --no-cache http://forexfactory.loc/forexfactory.php
define ("PATH_TO_FOLDER", "C:/Users/Vadim/AppData/Roaming/MetaQuotes/Terminal/D0E8209F77C8CF37AD8BF550E51FF075/MQL5/Files/");
// define ("PATH_TO_FOLDER", "E:/openserver522/openserver/domains/forexfactory.loc/");
define ("CSV_FILE_NAME", "forexfactoryparce.csv");
if(!file_exists(PATH_TO_FOLDER.CSV_FILE_NAME))
View googlefeed-1.php
<?php
try
{
switch (__DIR__) {
case 'D:\open-server500\OpenServer\domains\sitename.loc':
$dbh = new PDO("mysql:host=127.0.0.1; dbname=sitename_db", 'root', '');
break;
default:
$dbh = new PDO("mysql:host=localhost; dbname=dbname", 'dbusr', 'dbpwd');
break;
View randomstring.php
<?php
private function generateRandomPwd($length = 8)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
View form.html
<input id="usersmodel-pwd" name="UsersModel[pwd]" value="" type="text">
<a href="#generatepassword" id="generatepassword"><span>сгенерировать пароль</span></a>
View cut_title.php
<?php
function cut_title($string)
{
$desired_width = 70;
$string = substr($string, 0, $desired_width+1);
if (strlen($string) > $desired_width)
{
$string = wordwrap($string, $desired_width);
$i = strpos($string, "\n");
View cql_copy_table
CREATE TABLE table_new LIKE databasename.table_old;
INSERT table_new SELECT * FROM databasename.table_old;