This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace @app\your\namespace\controllers; | |
use Yii; | |
use yii\web\Controller; | |
use yii\filters\VerbFilter; | |
use yii\web\Response; | |
use yii\helpers\Json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?= $form->field( | |
$model, | |
'email', | |
[ | |
'enableClientValidation' => false, | |
] | |
)->input( | |
'email', | |
[ | |
'validate_pattern'=>'^([a-z0-9_\.-])+@[a-z0-9-]+\.([a-z]{2,4}\.)?[a-z]{2,4}$', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function rules() | |
{ | |
return [ | |
... | |
[['date_tmp'], 'safe'], | |
]; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Параметри для підключення до MySQL серверу | |
$servername = "127.0.0.1"; | |
$username = ""; | |
$password = ""; | |
error_reporting(E_DEBUG); | |
ini_set('display_errors', 'on'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Параметри для підключення до MySQL серверу | |
$servername = "127.0.0.1"; | |
$username = ""; | |
$password = ""; | |
$db = ""; | |
// Підключення до MySQL серверу | |
$conn = mysqli_connect($servername, $username, $password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//wordpress | |
if (file_exists('wp-config.php')) { | |
preg_match_all('/define\s*\(\s*[\'"](.*?)[\'"]\s*,\s*[\'"](.*?)[\'"]\s*\)\s*;/', file_get_contents('wp-config.php'), $matches, PREG_SET_ORDER); | |
foreach ($matches as $match) { | |
if(in_array($match[1],['DB_HOST','DB_USER','DB_PASSWORD','DB_NAME'],false)){ | |
define($match[1], $match[2]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use noam148\imagemanager\models\ImageManager; | |
/** | |
* Get the path for the given ImageManager_id record | |
* @param int $ImageManager_id ImageManager record for which the path needs to be generated | |
* @return null|string Full path is returned when image is found, null if no image could be found | |
*/ | |
public static function getOriginalImagePath($ImageManager_id) { | |
$return = null; | |
$model = ImageManager::findOne($ImageManager_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query->andFilterWhere(['OR', ['is', $key, new \yii\db\Expression('null')], ['<=','LENGTH('.$key.')',0]])->all(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
firewall-cmd --zone=public --remove-service=http --permanent | |
firewall-cmd --zone=public --remove-service=https --permanent | |
for ipv in v4 v6; do | |
for i in $(firewall-cmd --zone=public --list-all | grep http | grep "ip${ipv}" | awk '{print $4}' | awk -F '"' '{print $2}' | sort -u); do | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" service name="http" accept" | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" service name="https" accept" | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" port port="80" protocol="tcp" accept" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
for app in iptables ip6tables; do | |
if [[ $app =~ 6 ]]; then | |
index=6 | |
else | |
index=4 | |
fi | |
for chain in $($app -t filter -L -v -n | grep Chain | awk '{print $2}'); do | |
for id in $($app -t filter -L --line-numbers -n -Z $chain | egrep "\:(443|80)" | awk '{print $1}' | sort -r); do |
OlderNewer