battles/test.php

128 lines
4.6 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php if (isset($_GET['items'])) {
foreach (glob("i/sh/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
foreach (glob("i/sh/Podarki/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
foreach (glob("i/sh/runes/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
exit('EOF');
}
if (isset($_GET['obraz'])) {
foreach (glob("i/shadow/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
exit('EOF');
}
?>
<?php
// Подключаем библиотеку
require_once('./Database/Mysql.php');
require_once('./Database/Mysql/Exception.php');
require_once('./Database/Mysql/Statement.php');
// Подключение к СУБД, выбор кодировки и базы данных.
$db = Database_Mysql::create('localhost', 'user42163_onli', '1W7y2E8u')
->setCharset('utf8')
->setDatabaseName('user42163_onli');
?>
<!DOCTYPE html>
<html>
<head>
<title>Нычка</title>
<meta charset=utf-8>
</head>
<body style="background: silver;">
<?php
if (isset($_GET['dbshow'])) {
define("HOST","localhost");
define("USER","user42163_onli");
define("PASS","1W7y2E8u");
define("DB","user42163_onli");
$link = mysql_connect(HOST,USER,PASS) or die (mysql_error());
mysql_select_db(DB, $link);
mysql_query ("SET NAMES utf8");
$sql = "SELECT * FROM `lichka`";
// Скармливаем наш запрос MySQL
$result = mysql_query($sql) or die(mysql_error() ."<br/>". $sql);
// Рисуем табличку
$table = "<table border=1 width=100% align=center>\n";
while ($row = mysql_fetch_assoc($result))
{
$table .= "<tr>\n";
$table .= "<th>Lichka\n";
$table .= "<td>".$row['id']."</td>\n";
$table .= "<td>".$row['pers']."</td>\n";
$table .= "<td>".$row['text']."</td>\n";
$table .= "</tr>\n";
}
$table .= "</table><p>\n";
$sql2 = "SELECT * FROM `paldelo`";
// Скармливаем наш запрос MySQL
$result2 = mysql_query($sql2) or die(mysql_error() ."<br/>". $sql2);
// Рисуем табличку
$table2 = "<table border=1 width=100% align=center>\n";
while ($row2 = mysql_fetch_assoc($result2))
{
$table2 .= "<tr>\n";
$table2 .= "<th>Paldelo\n";
$table2 .= "<td>".$row2['id']."</td>\n";
$table2 .= "<td>".$row2['author']."</td>\n";
$table2 .= "<td>".$row2['text']."</td>\n";
$table2 .= "</tr>\n";
}
$table2 .= "</table>\n";
// Выводим заполненую таблицу на экран
echo $table.$table2; exit();
}
if (isset($_GET['phpinfo'])) phpinfo();
#echo $asd.' - local test<br>';
#echo $GLOBALS['asd'].' - global massive $GLOBALS test<br>';
#echo $_GET['asd'].' - $_GET["asd"]';
echo "Склонности: ";
foreach (glob("i/align_*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
echo "<br>Красные Кнопки: ";
foreach (glob("i/a__*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
echo "<br>Синие Кнопки: ";
foreach (glob("i/b__*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
echo "<br>Медали: ";
foreach (glob("i/medal*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
foreach (glob("i/pal*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
foreach (glob("i/tar*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
echo "<br>Свитки: ";
foreach (glob("i/magic/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
// Получить все...
$res = $db->query('SELECT * FROM `users` WHERE `id` = ?i','11263');
// Последовательно получать в виде ассоциативных массивов
while ($data = $res->fetch_assoc()) print_r($data['id']);
echo '<hr>';
$data = $res->fetch_assoc();
print_r($data['id']);
/*
function FixTables() {
$tables = mysql_query('SHOW TABLES');
while ($table = mysql_fetch_array($tables)) {
mysql_query('ALTER TABLE `actions` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
mysql_query('ALTER TABLE `actions` CONVERT TO CHARACTER SET utf8;');
}
echo "<b> CONVERTED!!! </b>";
}
if (isset($_GET['dbfix'])) {
mysql_connect('localhost', 'user42163_onli', '1W7y2E8u');
mysql_select_db('user42163_onli');
FixTables();
}
*/
?>
</body>
</html>