$selectValues = [
'value1' => 'Значение1',
'value2' => 'Значение2',
];
$currentValue = $selectValues[$_POST['select']];
<input type="hidden" name="selectText" value="" />
$first = [ 'Купить', 'Заказать', 'Приобрести', 'Предлагаем купить', 'Предлагаем приобрести', 'Предлагаем заказать' ];
$second = [ 'красивую', 'элегантную', 'дизайнерскую' ];
$third = [ 'юбку', 'кофту', 'пальто' ];
$fourth = [ 'в каталоге', 'в интернет-магазине', 'на сайте' ];
$out = [];
foreach ($third as $item) {
$set = [];
$set[] = array_rand($first);
$set[] = array_rand($second);
$set[] = $item;
$set[] = array_rand($fourth);
$out[] = implode(' ', $set);
}
echo implode(PHP_EOL, $out);
$temp_date = $_TIME - (3600 * 24 * 31);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_month = $row['count'];
$temp_date = $_TIME - (3600 * 24 * 7);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_week = $row['count'];
$temp_date = $_TIME - (7200 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$user_every = $row['count'];
$temp_date = $_TIME - (3600 * 24);
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE reg_date > '$temp_date'" );
$users_day = $row['count'];
$db->query( "SELECT user_group,reg_date FROM " . PREFIX . "_users" );
$admin_sum = 0;
$moder_sum = 0;
$vip_sum = 0;
$user_sum = 0;
$prouser_sum = 0;
while ($row = $db->get_row()) {
switch ($row['user_group']) {
case "1":
$admin_sum++;
break;
case "2":
$moder_sum++;
break;
case "3":
$vip_sum++;
break;
case "4":
$user_sum++;
break;
case "6":
$prouser_sum++;
break;
}
}
$stats_users = $admin_sum + $moder_sum + $vip_sum + $prouser_sum + $user_sum + 1; // +1 для правильного определения колличества пользователей.
$subId = $_REQUEST['subid'];
$url = array(
'http://site1.ru?subid='. $subId .'&subid1=land1',
'http://site2.ru?subid='. $subId .'&subid1=land2',
'http://site3.ru?subid='. $subId .'&subid1=land3'
);
string exec ( string $command [, array &$output [, int &$return_var ]] )
<?
require 'global_config.php';
$newsId = intval($_REQUEST['new']);
$nick = $_COOKIE['nick'];
$querybd = mysqli_query($connect, 'SELECT `yes` FROM `likenews` WHERE `nick`="'. $nick .'" AND `idnews` = '. $newsId .' LIMIT 1;');
if ($row = mysqli_fetch_array($querybd)) {
echo '<center>Вы уже ставили лайк этой записи.<br><a href="news.php">Обратно</a></center>';
} else {
$result = mysqli_query($connect, 'SELECT * FROM `news` WHERE `id` = '. $newsId .' LIMIT 1;');
if (mysqli_num_rows($result)) {
mysqli_query($connect, 'UPDATE `news` SET `like` = `like` + 1 WHERE `id` = '. $newsId .' LIMIT 1;');
mysqli_query($connect, 'INSERT INTO `likenews` (`nick`, `idnews`, `yes`) VALUES ("'. $nick .'", '. $newsId .', 1);');
echo '<center>Новость успешно лайкнута!<br><a href="news.php">Обратно</a></center>';
} else {
echo 'Новость не найдена!';
}
}
class HZip
{
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
*/
private static function folderToZip($folder, &$zipFile, $exclusiveLength) {
$handle = opendir($folder);
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
$filePath = "$folder/$f";
// Remove prefix from file path before add to zip.
$localPath = substr($filePath, $exclusiveLength);
if (is_file($filePath)) {
$zipFile->addFile($filePath, $localPath);
} elseif (is_dir($filePath)) {
// Add sub-directory.
$zipFile->addEmptyDir($localPath);
self::folderToZip($filePath, $zipFile, $exclusiveLength);
}
}
}
closedir($handle);
}
/**
* Zip a folder (include itself).
* Usage:
* HZip::zipDir('/path/to/sourceDir', '/path/to/out.zip');
*
* @param string $sourcePath Path of directory to be zip.
* @param string $outZipPath Path of output zip file.
*/
public static function zipDir($sourcePath, $outZipPath)
{
$pathInfo = pathInfo($sourcePath);
$parentPath = $pathInfo['dirname'];
$dirName = $pathInfo['basename'];
$z = new ZipArchive();
$z->open($outZipPath, ZIPARCHIVE::CREATE);
$z->addEmptyDir($dirName);
self::folderToZip($sourcePath, $z, strlen("$parentPath/"));
$z->close();
}
}
HZip::zipDir('/path/to/sourceDir', '/path/to/out.zip');