Хранилища Subversion linwin

Сравнить редакции

Не учитывать пробелы Редакция 1 → Редакция 2

/trunk/edit_template_sql.php
Новый файл
0,0 → 1,97
<?PHP
session_start();
if ($_SESSION['$user_privileges'] < 16)
header("Location: index.php");
include "head.php";
$mas_program_id = array();
if (count($_GET['mas_program_id']) > 0)
{
foreach ($_GET['mas_program_id'] as $val)
{
$mas_program_id[] = $val;
$mas_program_id[] = $val;
}
}
$mas_noprogram_id = array();
if (count($_GET['mas_noprogram_id']) > 0)
{
foreach ($_GET['mas_noprogram_id'] as $val)
{
$mas_noprogram_id[] = $val;
}
}
$template_id = $_GET['template_id'];
$template_name = $_GET['template_name'];
//Сохраняем данные о шаблоне
if ($_GET['save_template'] == "save")
{
$db = mysql_connect("localhost", "linwin");
mysql_select_db("linwin", $db);
mysql_query("SET NAMES 'utf8';", $db);
$sql = "UPDATE templates SET name = '". $template_name. "' WHERE id = ". $template_id;
if (mysql_query($sql, $db))
{
echo "<br/>Данные о шаблоне успешно обновлены<br/>";
}
else
{
echo "Данные о шаблоне не обновлены<br/>";
}
if (count($mas_noprogram_id) <> 0)
{
for ($i = 0; $i < count($mas_noprogram_id); $i++)
{
$sql = "INSERT INTO prog_in_temp(pid, tid) values ('". $mas_noprogram_id[$i]. "','". $template_id. "');";
if (mysql_query($sql, $db))
{
echo "<br/>Данные в таблицу prog_in_temp успешно внесены<br/>";
}
else
{
echo "Данные в таблицу prog_in_temp не внесены<br/>";
}
}
}
if (count($mas_program_id) <> 0)
{
for ($i = 0; $i < count($mas_program_id); $i++)
{
$sql = "DELETE FROM prog_in_temp WHERE pid = ". $mas_program_id[$i]. " and tid =". $template_id;
if (mysql_query($sql, $db))
{
echo "<br/>Данные из таблицы prog_in_temp успешно удалены<br/>";
}
else
{
echo "Данные из таблицы prig_in_temp не удалены<br/>";
}
}
}
mysql_close($db);
}
if ($_GET['delete_template'] == "delete")
{
$db = mysql_connect("localhost", "linwin");
mysql_select_db("linwin", $db);
mysql_query("SET NAMES 'utf8';", $db);
$sql = "SELECT id FROM prog_in_temp WHERE tid = '". $template_id. "'";
$query=mysql_query($sql, $db);
if (mysql_num_rows($query))
echo "<br/>Ошибка!!! В шаблоне еще есть программы!!!<br/>";
else
{
$sql = "DELETE FROM templates WHERE id = ". $template_id;
if (mysql_query($sql, $db))
{
echo "<br/>Шаблон успешно удален<br/>";
}
else
{
echo "Шаблон не удален<br/>";
}
}
mysql_close($db);
}
include "foot.php";
?>
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/head.php
===================================================================
--- trunk/head.php (revision 0)
+++ trunk/head.php (revision 2)
@@ -0,0 +1,71 @@
+<?PHP
+ session_start();
+ print "
+ <html>
+ <head>
+ <title></title>
+ <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=UTF-8\">
+ <META NAME=\"keywords\" CONTENT=\"\">
+ <META NAME=\"description\" CONTENT=\"\">
+ <LINK rel=stylesheet href=\"style/menu.css\" type=\"text/css\">
+ </head>
+ <body>
+ <table width = \"100%\" align = \"center\">
+ <tr>
+ <td valign = \"top\" width = \"200px\" >
+ <table align = \"left\" valign = \"top\" class = \"with-border\">
+ <tr><td align = \"center\"><b>Общее</b><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_program.php\">Список программ</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_section.php\">Список разделов</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"misc_view.php\">Другие представления</a></td></tr>
+ <tr><td align = \"center\"><hr/><b>Работа с шаблонами</b><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_templates.php\">Шаблоны</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"http://templates.uni-altai.ru/\">Просмотр образов и <br/>архивов шаблонов</a></td></tr>";
+ if (!$_SESSION['$user_login'])
+ print " <tr><td align = \"center\">
+ <form action = \"search_program_sql.php\">
+ <hr/><b>Поиск программ и разделов:</b><hr/>
+ <input type = \"text\" class = \"text\" name = \"search\"/><br/>
+ <input type = \"submit\" class = \"submit\" value = \"Найти\"/>
+ </form>
+ </td></tr>";
+ if (!$_SESSION['$user_login'])
+ print " <tr><td align = \"center\">
+ <form method = \"post\" action = \"auth.php\">
+ <hr/><b>Авторизация</b><hr/>
+ <input type = \"text\" class = \"text\" name = \"login\"/><br/>
+ <input type = \"password\" class = \"text\" name = \"password\"/><br/>
+ <input type = \"submit\" class = \"submit\" value = \"Авторизироваться\"/>
+ </form>
+ </td></tr>";
+ if ($_SESSION['$user_login'])
+ print "
+ <tr><td align = \"center\"><hr/><b>Административные функции</b><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"> Поиск программ и разделов:</td></tr>
+ <tr><td align = \"center\">
+ <form action = \"search_program_edit_sql.php\">
+ <input type = \"text\" class = \"text\" name = \"search\"/><br/>
+ <input type = \"submit\" class = \"submit\" value = \"Найти\"/>
+ </form>
+ </td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"insert_new_program.php\">Добавить программу</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_program_edit.php\">Список программ для редактирования</a></td></tr>
+ <tr><td><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"insert_new_section.php\">Добавить группу</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_section_edit.php\">Список групп для редактирования</a></td></tr>
+ <tr><td><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"view_templates_edit.php\">Список шаблонов для редактирования</a></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"insert_template.php\">Создание шаблона</a></td></tr>
+ <tr><td><hr/></td></tr>
+ <tr><td><img src=\"style/bullet.gif\" alt=\"\"><a href = \"test_base.php\">Тестирование базы</a></td></tr>
+ <tr><td><hr/></td></tr>
+ <tr><td align = \"center\">
+ <form action = \"logout.php\">
+ <input type = \"submit\" class = \"submit\" value = \"Выход\"/>
+ </form>
+ </td></tr>";
+ print " </table>
+ </td>
+ <td align = \"center\" valign = \"top\">
+ ";
+?>
\ No newline at end of file
/trunk/head.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_new_section.php
===================================================================
--- trunk/insert_new_section.php (revision 0)
+++ trunk/insert_new_section.php (revision 2)
@@ -0,0 +1,24 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ print "
+ <form action = \"insert_new_section_sql.php\">
+ <table class = \"without-border\">
+ <tr>
+ </td>
+ <td>
+ <table>
+ <tr><td>Имя группы</td></tr>
+ <td><input type = \"text\" class = \"text\" size = \"25\" name = \"section_name\"></input></td></tr>
+ <tr><td>Описание группы</td></tr>
+ <tr><td><textarea cols = \"25\" name = \"section_description\" rows = \"4\"></textarea></td></tr>
+ </table>
+ </td>
+ </tr>
+ <tr><td><input class = \"submit\" type = \"submit\" value = \"Сохранить\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
/trunk/insert_new_section.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_section_edit.php
===================================================================
--- trunk/view_section_edit.php (revision 0)
+++ trunk/view_section_edit.php (revision 2)
@@ -0,0 +1,23 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name, description FROM section ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_section_id[] = mysql_result($query,$i,0);
+ $mas_section_name[] = mysql_result($query,$i,1);
+ $mas_section_description[] = mysql_result($query,$i,2);
+ }
+ mysql_close($db);
+ print "<table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\"><tr><td><b>Название разделов</b></td><td><b>Описание</b></td><tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ echo "<tr><td bgcolor = \"ffffff\"><a href = edit_section.php?section_id=". $mas_section_id[$i]. ">". $mas_section_name[$i]. "</a></td><td bgcolor = \"ffffff\">". $mas_section_description[$i];
+ }
+ print "</tr></table>";
+ include "foot.php";
+?>
/trunk/view_section_edit.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_new_program.php
===================================================================
--- trunk/insert_new_program.php (revision 0)
+++ trunk/insert_new_program.php (revision 2)
@@ -0,0 +1,50 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ print "
+ <form action = \"insert_new_program_sql.php\">
+ <table><tr><td valign = \"top\">
+ <table>
+ <tr><td colspan = \"2\" align = \"center\"><b>Общие данные о программе:</b></td></tr>
+ <tr><td></td><td><input type = \"hidden\" name = \"program_id\" value = \"$program_id\"/></td></tr>
+ <tr><td><b>Производитель:</b></td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_manufacturer\" value = \"$program_manufacturer\"/></td></tr>
+ <tr><td><b>Название программы:</b></td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_name\" value = \"$program_name\"/></td></tr>
+ <tr><td><b>Описание программы:</b></td><td><textarea cols = \"40\" name = \"program_description\" rows = \"7\">$program_description</textarea></td></tr>
+ <tr><td colspan = \"2\" align = \"center\"><br/></b></td></tr>
+ <tr><td colspan = \"2\" align = \"center\"><b>URL связанные с программой:</b></td></tr>
+ <tr><td><b>Официальный сайт:</b></td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_site\" value = \"\"/></td></tr>
+ <tr><td><b>Локальное зеркало:</b></td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_mirror\" value = \"\"/></td></tr>
+ </table>
+ </td>";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id, name FROM section ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ }
+ mysql_close($db);
+ echo "<td><table><tr><td valign = \"top\"><b>Добавить группы, в которые входит данная программа:</b></td></tr>";
+ for ($i = 0; $i < count($mas_section_id); $i++)
+ {
+ if ($mas_prog_in_sect[$i] <> "checked")
+ {
+ print "<tr><td><input type = \"checkbox\" name = \"section_insert_id[]\" value = \"$mas_section_id[$i]\">$mas_section_name[$i]</input></td></tr>";
+ }
+ }
+ echo "</table></td></tr>
+ <tr><td colspan = \"2\"><hr/></td></tr>
+ <tr><td></td><td align = \"right\"><input type = \"submit\" class = \"submit\" name = \"save_program\" value = \"save\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
+
/trunk/insert_new_program.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/config.php
===================================================================
--- trunk/config.php (revision 0)
+++ trunk/config.php (revision 2)
@@ -0,0 +1,10 @@
+<?php
+ $base_dir_linwin = "/var/www/linwin/";
+ $base_url_linwin = "http://localhost/linwin2/";
+ $base_url_software = "http://software.uni-altai.ru/";
+ $base_url_templates = "http://templates.uni-altai.ru/";
+ $temp_dir = "/home/leon/temp123/";
+ $template_dir = "/home/leon/temp1234/";
+ //debug. Если значение установлено в 1, на страницах бедет выводится дополнительная информация.
+ $debug = "0";
+?>
\ No newline at end of file
Index: trunk/index.php
===================================================================
--- trunk/index.php (revision 0)
+++ trunk/index.php (revision 2)
@@ -0,0 +1,4 @@
+<?PHP
+ include "head.php";
+ include "foot.php";
+?>
/trunk/index.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/create_iso_template.php
===================================================================
--- trunk/create_iso_template.php (revision 0)
+++ trunk/create_iso_template.php (revision 2)
@@ -0,0 +1,103 @@
+<?PHP
+//Проверяем авторизацию
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ include "config.php";
+ $template_id = $_GET['template_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+
+ //Загружем данные шаблона
+ $sql = "SELECT name FROM templates WHERE id = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $template_name = mysql_result($query,0,0);
+
+ //Загружаем таблицу программ входящих в шаблон
+ $sql = "SELECT pid FROM prog_in_temp WHERE tid = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_temp_id[$i] = mysql_result($query,$i,0);
+ $sql_part = "('". $mas_prog_in_temp_id[0];
+ for ($i = 1; $i < count($mas_prog_in_temp_id); $i++)
+ {
+ $sql_part = $sql_part. "','". $mas_prog_in_temp_id[$i];
+ }
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name, description FROM program WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ $mas_program_name[] = mysql_result($query, $i, 1);
+ $mas_program_description[] = mysql_result($query, $i, 2);
+ }
+
+ //Загружем таблицу урлов для программ данного шаблона
+ $sql = "SELECT id, description,url, local_mirror FROM url WHERE pid in ". $sql_part;
+ $query = mysql_query($sql, $db);
+ $mas_url_id = array();
+ $mas_url_description = array();
+ $mas_url_url = array();
+ $mas_local_mirror = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_url_id[] = mysql_result($query, $i, 0);
+ $mas_url_description[] = mysql_result($query, $i, 1);
+ $mas_url_url[] = mysql_result($query, $i, 2);
+ $mas_url_local_mirror[] = mysql_result($query, $i, 3);
+ }
+
+ //Очищаем каталог временных файлов
+ $exec = "rm -rf $temp_dir"."* && /usr/bin/php-cgi -q $base_dir_linwin". "create_index.php template_id=". "$template_id > $temp_dir". "index.html";
+ if ($debug == "1")
+ print "<br/>Строка запуска rm:<br/>$exec<br/>";
+ $program_out = shell_exec($exec);
+ if ($debug == "1")
+ print "<br/>Что выдал exec после запуска:<br/>$program_out<br/>";
+
+ //Выкачиваем все урлы
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ if ($mas_url_local_mirror[$i] == "1")
+ {
+ $exec = "cd $temp_dir && /usr/bin/wget -nH -x -N". " $base_url_software$mas_url_url[$i]";
+ if ($debug == "1")
+ print "<br/>Строка запуска wget:<br/>$exec<br/>";
+ $program_out = shell_exec($exec);
+ if ($debug == "1")
+ print "<br/>Что выдал exec после запуска:<br/>$program_out<br/>";
+ print "Выкачали($i из $num_record(не верно!!!)): ". "$mas_url_url[$i]". "<br/>";
+ }
+ }
+
+ //Подготавливаем html
+ $exec = "/usr/bin/php-cgi -q $base_dir_linwin". "create_index.php template_id=". "$template_id > $temp_dir". "index.html";
+ if ($debug == "1")
+ print "<br/>Строка запуска php-cgi:<br/>$exec<br/>";
+ $program_out = shell_exec($exec);
+ if ($debug == "1")
+ print "<br/>Что выдал exec после запуска:<br/>$program_out<br/>";
+
+ //Создаем iso образ
+ $exec = "/usr/bin/genisoimage -J -o $template_dir". "$template_name". ".iso $temp_dir";
+ if ($debug == "1")
+ print "<br/>Строка запуска genisoimage:<br/>$exec<br/>";
+ $program_out = shell_exec($exec);
+ if ($debug == "1")
+ print "<br/>Что выдал exec после запуска:<br/>$program_out<br/>";
+
+ //Создаем zip архив
+ $exec = "cd $temp_dir && /usr/bin/zip -9 -r $template_dir". "$template_name". " *";
+ $program_out = shell_exec($exec);
+
+ include "foot.php";
+?>
/trunk/create_iso_template.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/test_base.php
===================================================================
--- trunk/test_base.php (revision 0)
+++ trunk/test_base.php (revision 2)
@@ -0,0 +1,81 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, pid, sid FROM prog_in_sect;", $db);
+ $num_record = mysql_num_rows($query);
+ $mas_id = array();
+ $mas_pid = array();
+ $mas_sid = array();
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_id[$i] = mysql_result($query,$i,0);
+ $mas_pid[$i] = mysql_result($query,$i,1);
+ $mas_sid[$i] = mysql_result($query,$i,2);
+ }
+ print "
+ <p>Тестирование баз</p>
+ <p>1) Проверяем, есть ли в базе prog_in_sect записи, в которых спользуется pid, равный id несуществующей программы:</p>";
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $sql = "SELECT id FROM program WHERE id = '". $mas_pid[$i]. "';";
+ $query=mysql_query($sql, $db);
+ $num_record_prog = mysql_num_rows($query);
+ if (!$num_record_prog)
+ print "<p>id = $mas_id[$i]<br/>pid = $mas_pid[$i]<br/>sid = $mas_sid[$i]<br/></p>";
+ }
+ print "<p>2) Проверяем, есть ли в базе prog_in_sect записи, в которых спользуется sid, равный id несуществующей группы:</p>";
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $sql = "SELECT id FROM section WHERE id = '". $mas_sid[$i]. "';";
+ $query=mysql_query($sql, $db);
+ $num_record_sect = mysql_num_rows($query);
+ if (!$num_record_sect)
+ print "<p>id = $mas_id[$i]<br/>pid = $mas_pid[$i]<br/>sid = $mas_sid[$i]<br/></p>";
+ }
+ $query=mysql_query("SELECT id, name FROM program;", $db);
+ $num_record = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query,$i,0);
+ $mas_program_name[$i] = mysql_result($query,$i,1);
+ }
+ print "<p>3) Проверяем, есть ли в базе program записи, id которой не использует ни одна запись из базы prog_in_sect:</p>";
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $sql = "SELECT id FROM prog_in_sect WHERE pid = '". $mas_program_id[$i]. "';";
+ $query=mysql_query($sql, $db);
+ $num_record_program = mysql_num_rows($query);
+ if (!$num_record_program)
+ print "<p>id = $mas_program_id[$i]<br/>name = $mas_program_name[$i]</p>";
+ }
+ print "<p>4) Проверяем, есть ли в базе URL записи, использующие id несуществующей программы:</p>";
+ $query=mysql_query("SELECT id, pid, url, description FROM url;", $db);
+ $num_record = mysql_num_rows($query);
+ $mas_program_url_id = array();
+ $mas_program_url_pid = array();
+ $mas_program_url_description = array();
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_url_id[$i] = mysql_result($query,$i,0);
+ $mas_program_url_pid[$i] = mysql_result($query,$i,1);
+ $mas_program_url_description[$i] = mysql_result($query,$i,2);
+ }
+
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $sql = "SELECT id FROM program WHERE id = '". $mas_program_url_pid[$i]. "';";
+ $query=mysql_query($sql, $db);
+ $num_record_prog = mysql_num_rows($query);
+ if (!$num_record_prog)
+ print "<p>id = $mas_program_url_id[$i]<br/>pid = $mas_mas_program_url_pid[$i]<br/>sid = $mas_program_url_description[$i]<br/></p>";
+ }
+ mysql_close($db);
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/test_base.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/search_program_sql.php
===================================================================
--- trunk/search_program_sql.php (revision 0)
+++ trunk/search_program_sql.php (revision 2)
@@ -0,0 +1,75 @@
+<?PHP
+ include "head.php";
+ $search = $_GET['search'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+
+ $sql = "SELECT id, name, description FROM program WHERE name like '%". $search. "%' or description like '%". $search. "%' ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $num_program = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ for ($i = 0; $i < $num_program; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query, $i, 0);
+ $mas_program_name[$i] = mysql_result($query, $i, 1);
+ $mas_program_description[$i] = mysql_result($query, $i, 2);
+ }
+
+ $sql = "SELECT id, name, description FROM section WHERE name like '%". $search. "%' or description like '%". $search. "%' ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $num_section = mysql_num_rows($query);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $mas_section_description = array();
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ $mas_section_description[$i] = mysql_result($query, $i, 2);
+ }
+ mysql_close($db);
+ print "
+ <p><b>Найденные группы:</b></p>
+ <hr/>
+ <table width = \"100%\">
+ <tr>
+ <td><b>Название группы</b></td>
+ <td><b>Описание</b></td>
+ </tr>
+ <tr>
+ <td><br/></td>
+ <td><br/></td>
+ </tr>";
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ #echo "<tr><td class = \"border-tb\">$mas_program_name[$i]</td></tr>";
+ print "
+ <tr><td><a href = view_section_wood.php?section_id=$mas_section_id[$i]>$mas_section_name[$i]</td>
+ <td>$mas_section_description[$i]</td></tr>";
+ }
+ print "</table>";
+
+ print "
+ <p><b>Найденные программы:</b></p>
+ <hr/>
+ <table width = \"100%\">
+ <tr>
+ <td><b>Название программы</b></td>
+ <td><b>Описание</b></td>
+ </tr>
+ <tr>
+ <td><br/></td>
+ <td><br/></td>
+ </tr>";
+ for ($i = 0; $i < $num_program; $i++)
+ {
+ #echo "<tr><td class = \"border-tb\">$mas_program_name[$i]</td></tr>";
+ print "
+ <tr><td><a href = what_is_the_program.php?program_id=$mas_program_id[$i]>$mas_program_name[$i]</td>
+ <td>$mas_program_description[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
/trunk/search_program_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_template_sql.php
===================================================================
--- trunk/insert_template_sql.php (revision 0)
+++ trunk/insert_template_sql.php (revision 2)
@@ -0,0 +1,69 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $mas_program_insert_id = array();
+ if (count($_GET['mas_program_id']) > 0)
+ {
+ foreach ($_GET['mas_program_id'] as $val)
+ {
+ $mas_program_insert_id[] = $val;
+ }
+ }
+ $template_name = $_GET['template_name'];
+
+ print "$template_name";
+
+ if ($_GET['create_template'] == "create")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "INSERT INTO templates(name) values ('". $template_name. "')";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Шаблон успешно добавлен.<br/>";
+ }
+ else
+ {
+ echo "Шаблон не добавлен<br/>";
+ }
+ $template_id = mysql_insert_id();
+ if (count($mas_program_insert_id) <> 0)
+ {
+ for ($i = 0; $i < count($mas_program_insert_id); $i++)
+ {
+ $sql = "INSERT INTO prog_in_temp(pid, tid) values ('". $mas_program_insert_id[$i]. "','". $template_id. "');";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу prog_in_temp успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу prog_in_temp не внесены<br/>";
+ }
+ }
+ }
+ if (count($mas_section_delete_id) <> 0)
+ {
+ for ($i = 0; $i < count($mas_section_delete_id); $i++)
+ {
+ $sql = "DELETE FROM prog_in_sect WHERE pid = ". $program_id. " and sid =". $mas_section_delete_id[$i];
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные из таблицы prog_in_sect успешно удалены<br/>";
+ }
+ else
+ {
+ echo "Данные из таблицы prig_in_sect не удалены<br/>";
+ }
+ }
+ }
+ mysql_close($db);
+ }
+ if ($_GET['cancel'] == "cancel")
+ {
+ }
+ include "foot.php";
+?>
/trunk/insert_template_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_template.php
===================================================================
--- trunk/edit_template.php (revision 0)
+++ trunk/edit_template.php (revision 2)
@@ -0,0 +1,100 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ include "config.php";
+ $template_id = $_GET['template_id'];
+ if ($debug == "1")
+ print "<br/>Переданный ID шаблона:<br/>$template_id<br/>";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+
+ //Загружаем данные о шаблоне
+ $sql = "SELECT name FROM templates WHERE id = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $template_name = mysql_result($query,0,0);
+
+ //Загружаем id программ входящих в шаблон
+ $sql = "SELECT pid FROM prog_in_temp WHERE tid = ". $template_id;
+ $query = mysql_query($sql, $db);
+ $mas_program_id = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ }
+
+ //Создаем группу ID программ входящих в шаблон
+ $sql_part = "('". $mas_program_id[0];
+ if ($num_record > 0)
+ {
+ for ($i = 1; $i < $num_record; $i++)
+ {
+ $sql_part = $sql_part. "','". $mas_program_id[$i];
+ }
+ }
+ $sql_part = $sql_part ."')";
+ if ($debug == "1")
+ print "<br/>Группа ID программ входящих в шаблон:<br/>$sql_part<br/>";
+
+ //Загружаем данные о программах входящих в шаблон
+ $sql = "SELECT id, name, manufacturer, description FROM program WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_manufacturer = array();
+ $mas_program_description = array();
+ $num_record_program = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record_program; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ $mas_program_name[] = mysql_result($query, $i, 1);
+ $mas_program_manufacturer[] = mysql_result($query, $i, 2);
+ $mas_program_description[] = mysql_result($query, $i, 3);
+ }
+
+ //Загружаем данные о программах НЕ входящих в шаблон
+ $sql = "SELECT id, name, manufacturer, description FROM program WHERE id not in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_noprogram_id = array();
+ $mas_noprogram_name = array();
+ $mas_noprogram_manufacturer = array();
+ $mas_noprogram_description = array();
+ $num_record_noprogram = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record_noprogram; $i++)
+ {
+ $mas_noprogram_id[] = mysql_result($query, $i, 0);
+ $mas_noprogram_name[] = mysql_result($query, $i, 1);
+ $mas_noprogram_manufacturer[] = mysql_result($query, $i, 2);
+ $mas_noprogram_description[] = mysql_result($query, $i, 3);
+ }
+ print "
+ <form action = \"edit_template_sql.php\">
+ <table align = \"center\">
+ <tr><td colspan = \"2\" align = \"center\"><b>Общие данные о шаблоне:</b></td></tr>
+ <tr><td><input type = \"hidden\" name = \"template_id\" value = \"$template_id\"/></td><td></td></tr>
+ <tr><td>Имя шаблона:</td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"template_name\" value = \"$template_name\"/></td></tr>
+ </table>";
+ print "
+ <table>
+ <tr><td><b>Программы входящие в шаблон:</b></td><td><b>Программы не входящие в шаблон</b></td></tr>
+ <tr><td valign = \"top\">";
+ for ($i = 0; $i < $num_record_program; $i++)
+ {
+ print "<input type = \"checkbox\" name = \"mas_program_id[]\" value = \"$mas_program_id[$i]\">$mas_program_name[$i],$mas_program_manufacturer[$i]</input><br/>";
+ }
+ print "</td><td valign = \"top\">";
+ for ($i = 0; $i < $num_record_noprogram; $i++)
+ {
+ print "<input type = \"checkbox\" name = \"mas_noprogram_id[]\" value = \"$mas_noprogram_id[$i]\">$mas_noprogram_name[$i], $mas_noprogram_manufacturer[$i]</input><br/>";
+ }
+ print "
+ </td></tr>
+ <tr><td><br/><input type = \"submit\" class = \"submit\" name = \"delete_template\" value = \"delete\"/></td>
+ <td><br/><input type = \"submit\" class = \"submit\" name = \"save_template\" value = \"save\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
/trunk/edit_template.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/program_in_section.php
===================================================================
--- trunk/program_in_section.php (revision 0)
+++ trunk/program_in_section.php (revision 2)
@@ -0,0 +1,66 @@
+<?PHP
+ include "head.php";
+ print "<h1 align = \"center\">Нот арбайтен!</h1><br/>";
+ $section = $_GET['section'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id, name FROM section";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $mas_prog_name = array();
+ $mas_prog_id = array();
+ $num_program = array();
+ $mas_prog_in_sect = array();
+ $num_section = mysql_num_rows($query);
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ }
+ for ($j = 0; $j < $num_section; $j++)
+ {
+ $sql = "SELECT pid FROM prog_in_sect WHERE sid = ". $mas_section_id[$j]. ";";
+ $query = mysql_query($sql, $db);
+ $num_program[$j] = mysql_num_rows($query);
+ for ($i = 0; $i < $num_program[$j]; $i++)
+ {
+ $mas_prog_id[$j][$i] = mysql_result($query,$i,0);
+ }
+ for ($i = 0; $i < $num_program[$j]; $i++)
+ {
+ $sql = "SELECT name FROM program WHERE id = ". $mas_prog_id[$j][$i]. ";";
+ $query=mysql_query($sql, $db);
+ $mas_prog_name[$j][$i] = mysql_result($query,0,0);
+ }
+ }
+ mysql_close($db);
+ print "
+ <table width = \"100%\">
+ <tr>
+ <td width = \"33%\"></td><td width = \"33%\"><b>Платные программы</b></td><td width = \"33%\"><b>Бесплатный программы аналоги</b></td>
+ </tr>";
+ for ($j = 0; $j < $num_section; $j++)
+ {
+ print "<tr><td><br/></td></tr>";
+ print "<tr><td><b>$mas_section_name[$j]</b></td><td>";
+ for($i=0; $i < $num_program[$j]; $i++)
+ {
+ if ($mas_prog_payment[$j][$i])
+ echo $mas_prog_name[$j][$i]. "<br/>";
+ }
+ print "</td><td>";
+ for($i=0; $i < $num_program[$j]; $i++)
+ {
+ if (!$mas_prog_payment[$j][$i])
+ echo $mas_prog_name[$j][$i]. "<br/>";
+ }
+ print "</td></tr>";
+ }
+ print "
+ </table>
+ </tr>
+ </table>";
+ include "foot.php";
+?>
/trunk/program_in_section.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/what_is_the_program.php
===================================================================
--- trunk/what_is_the_program.php (revision 0)
+++ trunk/what_is_the_program.php (revision 2)
@@ -0,0 +1,79 @@
+<?PHP
+ include "head.php";
+ include "config.php";
+ $program_id_transfer = $_GET['program_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT manufacturer, name, description FROM program WHERE id = ". $program_id_transfer;
+ $query=mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ $mas_program_manufacturer = mysql_result($query,$i,0);
+ $mas_program_name = mysql_result($query,$i,1);
+ $mas_program_description = mysql_result($query,$i,2);
+ print "
+ <table>
+ <tr><td><b>Производитель:</b></td><td>$mas_program_manufacturer</td></tr>
+ <tr><td><b>Название программы:</b></td><td>$mas_program_name</td></tr>
+ <tr><td><b>Описание программы:</b></td><td>$mas_program_description</td></tr>";
+ $sql = "SELECT sid FROM prog_in_sect WHERE pid = ". $program_id_transfer;
+ $query=mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_sect_id[] = mysql_result($query,$i,0);
+ $sql_part = "('". $mas_prog_in_sect_id[0];
+ for ($i = 1; $i < count($mas_prog_in_sect_id); $i++)
+ {
+ $sql_part = $sql_part. "','". $mas_prog_in_sect_id[$i];
+ }
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name, description FROM section WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_id[] = mysql_result($query, $i, 0);
+ $mas_section_name[] = mysql_result($query, $i, 1);
+ $mas_section_description[] = mysql_result($query, $i, 2);
+ }
+
+ print "<tr><td><b>Группы, в которые входит программа:</b></td><td><table>";
+ for ($i = 0; $i < count($mas_section_id); $i++)
+ {
+ print "<tr><td><a href = \"view_section_wood.php?section_id=$mas_section_id[$i]\">$mas_section_name[$i]</a></td></tr>";
+ }
+ print "
+ </table>
+ <br/>";
+
+ //Загружаем УРЛ связанные с программой
+ $sql = "SELECT url, description, local_mirror FROM url WHERE pid = ". $program_id_transfer;
+ $query = mysql_query($sql, $db);
+ $mas_url_url = array();
+ $mas_url_description = array();
+ $mas_url_local_mirror = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_url_url[] = mysql_result($query, $i, 0);
+ $mas_url_description[] = mysql_result($query, $i, 1);
+ $mas_url_local_mirror[] = mysql_result($query, $i, 2);
+ }
+ mysql_close($db);
+ print "<tr><td><b>URL связанные с программой:</b></td><td><table>";
+ for ($i = 0; $i < count($mas_url_url); $i++)
+ {
+ if ($mas_url_local_mirror[$i] ==1)
+ print "<tr><td><a href = \"$base_url_software/$mas_url_url[$i]\">$mas_url_description[$i](Локальное зеркало)</a></td></tr>";
+ else
+ print "<tr><td><a href = \"$mas_url_url[$i]\">$mas_url_description[$i]</a></td></tr>";
+ }
+ print "
+ </table>
+ </td>
+ </tr></table>";
+
+ include "foot.php";
+?>
/trunk/what_is_the_program.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_section_wood.php
===================================================================
--- trunk/view_section_wood.php (revision 0)
+++ trunk/view_section_wood.php (revision 2)
@@ -0,0 +1,135 @@
+<?PHP
+ include "head.php";
+ include "config.php";
+ $mas_no_section_id_transfer = array();
+ $mas_no_section_id_transfer[] = $_GET['section_id'];
+ if (count($_GET['no_section_id']) > 0)
+ foreach ($_GET['no_section_id'] as $val)
+ $mas_no_section_id_transfer[] = $val;
+ $section_id_transfer = $_GET['section_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT pid FROM prog_in_sect WHERE sid = ". $mas_no_section_id_transfer[0];
+ $query=mysql_query($sql, $db);
+ $mas_sect_id = array();
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ {
+ $mas_prog_in_sect_id[0][$i] = mysql_result($query,$i,0);
+ }
+ for ($j = 1; $j < count($mas_no_section_id_transfer); $j++)
+ {
+ $sql_part = "('";
+ for ($i = 0; $i < $num_record; $i++)
+ $sql_part = $sql_part. "','". $mas_prog_in_sect_id[$j-1][$i];
+ $sql_part = $sql_part. "')";
+ $sql ="SELECT pid FROM prog_in_sect WHERE sid = ". $mas_no_section_id_transfer[$j]. " and pid in ". $sql_part;
+ $query=mysql_query($sql, $db);
+ $mas_sect_id = array();
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_sect_id[$j][$i] = mysql_result($query,$i,0);
+ }
+ $sql_part = "('". $mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1][0];
+ for ($i = 1; $i < count($mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1]); $i++)
+ $sql_part = $sql_part. "','". $mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1][$i];
+ $sql_part = $sql_part. "')";
+ if ($debug == "1")
+ print "<br/>sql_part:<br/>$sql_part<br/>";
+
+ $sql = "SELECT id, name, description FROM program WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query, $i, 0);
+ $mas_program_name[$i] = mysql_result($query, $i, 1);
+ $mas_program_description[$i] = mysql_result($query, $i, 2);
+ }
+ $sql_part = "pid in ('". $mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1][0];
+ for ($i = 1; $i < count($mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1]); $i++)
+ $sql_part = $sql_part. "','". $mas_prog_in_sect_id[count($mas_prog_in_sect_id)-1][$i];
+ $sql_part = $sql_part. "')";
+ if (count($mas_no_section_id_transfer))
+ {
+ $sql_part = $sql_part. " and sid not in ('". $mas_no_section_id_transfer[0];
+ for ($i = 1; $i < count($mas_no_section_id_transfer); $i++)
+ $sql_part = $sql_part. "','". $mas_no_section_id_transfer[$i];
+ $sql_part = $sql_part. "')";
+ }
+ $sql = "SELECT sid FROM prog_in_sect WHERE ". $sql_part;
+ $query=mysql_query($sql, $db);
+ $mas_sect_id = array();
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_id[] = mysql_result($query,$i,0);
+ }
+ if (count($mas_section_id))
+ {
+ $sql_part = "('". $mas_section_id[0];
+ for ($i = 1; $i < count($mas_section_id); $i++)
+ $sql_part = $sql_part. "','". $mas_section_id[$i];
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name FROM section WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_id[] = mysql_result($query, $i, 0);
+ $mas_section_name[] = mysql_result($query, $i, 1);
+ }
+ }
+ $sql_part = "('". $mas_no_section_id_transfer[0];
+ for ($i = 1; $i < count($mas_no_section_id_transfer); $i++)
+ $sql_part = $sql_part. "','". $mas_no_section_id_transfer[$i];
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name FROM section WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_section_in_id = array();
+ $mas_section_in_name = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_in_id[] = mysql_result($query, $i, 0);
+ $mas_section_in_name[] = mysql_result($query, $i, 1);
+ }
+ mysql_close($db);
+
+
+ print "
+ <table width = \"100%\" align = \"center\">
+ <tr><td width = \"50%\" align = \"left\" valign = \"top\"><b>Программы находятся в группах:</b><br/>";
+ for ($i = 0; $i < count($mas_section_in_id); $i++)
+ print "$mas_section_in_name[$i]<br/> ";
+ print "
+ </td><td><table>";
+ $no_section_id = "";
+ for ($i = 0; $i < count($mas_no_section_id_transfer); $i++)
+ $no_section_id = $no_section_id. "&no_section_id%5B%5D=". $mas_no_section_id_transfer[$i];
+ print "<tr><td><b>Группы:</b><br/>";
+ for ($i = 0; $i < count($mas_section_id); $i++)
+ print "<a href = \"view_section_wood.php?section_id=$mas_section_id[$i]&$no_section_id\">$mas_section_name[$i]</a><br/>";
+ print "
+ </td></tr></table></td></tr>
+ <tr><td colspan = \"2\"><hr/></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><b>Программы:</b><br/>
+ <table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\">
+ <tr><td><b>Название программы</b></td><td><b>Описание</b></td>
+ </tr>";
+ for ($i = 0; $i < count($mas_program_id); $i++)
+ {
+ print "<tr><td bgcolor = \"ffffff\"><a href = what_is_the_program.php?program_id=$mas_program_id[$i] >$mas_program_name[$i]</a></td><td bgcolor = \"ffffff\">$mas_program_description[$i]</td></tr>";
+ }
+
+ print "
+ </table>
+ </td></tr></table>";
+include "foot.php";
+?>
/trunk/view_section_wood.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_section_sql.php
===================================================================
--- trunk/edit_section_sql.php (revision 0)
+++ trunk/edit_section_sql.php (revision 2)
@@ -0,0 +1,42 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $section_id = $_GET['section_id'];
+ $section_name = $_GET['section_name'];
+ $section_description = $_GET['section_description'];
+ if ($_GET['save_section'] == "save")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "UPDATE section SET name = '". $section_name. "', description = '". $section_description. "' WHERE id = ". $section_id;
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные о группе успешно обновлены<br/>";
+ }
+ else
+ {
+ echo "Данные о группе не обновлены<br/>";
+ }
+ mysql_close($db);
+ }
+ if ($_GET['delete_section'] == "delete")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "DELETE FROM section WHERE id = ". $section_id;
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Группа успешно удалена<br/>";
+ }
+ else
+ {
+ echo "Группа не удалена<br/>";
+ }
+ mysql_close($db);
+ }
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/edit_section_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_templates.php
===================================================================
--- trunk/view_templates.php (revision 0)
+++ trunk/view_templates.php (revision 2)
@@ -0,0 +1,27 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name FROM templates ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas_templates_id = array();
+ $mas_templates_name = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_templates_id[$i] = mysql_result($query,$i,0);
+ $mas_templates_name[$i] = mysql_result($query,$i,1);
+ }
+ mysql_close($db);
+ print "
+ <table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\">
+ <tr>
+ <td><b>Название шаблона</b></td>
+ </tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ print "<tr><td bgcolor = \"ffffff\"><a href = what_is_the_template.php?template_id=$mas_templates_id[$i]>$mas_templates_name[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
/trunk/view_templates.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/what_is_the_template.php
===================================================================
--- trunk/what_is_the_template.php (revision 0)
+++ trunk/what_is_the_template.php (revision 2)
@@ -0,0 +1,53 @@
+<?PHP
+ session_start();
+ include "head.php";
+ $template_id = $_GET['template_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT name FROM templates WHERE id = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $template_name = mysql_result($query,0,0);
+ print "
+ <table>
+ <tr><td><b>ID шаблона:</b></td><td>$template_id</td></tr>
+ <tr><td><b>Название шаблона:</b></td><td>$template_name</td></tr>";
+ $sql = "SELECT pid FROM prog_in_temp WHERE tid = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_temp_id[$i] = mysql_result($query,$i,0);
+ $sql_part = "('". $mas_prog_in_temp_id[0];
+ for ($i = 1; $i < count($mas_prog_in_temp_id); $i++)
+ {
+ $sql_part = $sql_part. "','". $mas_prog_in_temp_id[$i];
+ }
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name, description FROM program WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ $mas_program_name[] = mysql_result($query, $i, 1);
+ $mas_program_description[] = mysql_result($query, $i, 2);
+ }
+
+ print "<tr><td><b>Программы, входящие в шаблон:</b></td><td><table>";
+ for ($i = 0; $i < count($mas_program_id); $i++)
+ {
+ print "<tr><td><a href = \"view_section_wood.php?section_id=$mas_program_id[$i]\">$mas_program_name[$i]</a></td><td>$mas_program_description[$i]</td></tr>";
+ }
+ print "
+ </table>
+ </table>";
+ if ($_SESSION['$user_privileges'] >= 16)
+ print "
+ <table>
+ <tr align = \"left\"><td><a href = \"create_iso_template.php?template_id=$template_id\">Создать ISO образ</a></td></tr>
+ </table>";
+ include "foot.php";
+?>
/trunk/what_is_the_template.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_program_sql.php
===================================================================
--- trunk/edit_program_sql.php (revision 0)
+++ trunk/edit_program_sql.php (revision 2)
@@ -0,0 +1,96 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $mas_section_insert_id = array();
+ if (count($_GET['section_insert_id']) > 0)
+ {
+ foreach ($_GET['section_insert_id'] as $val)
+ {
+ $mas_section_insert_id[] = $val;
+ }
+ }
+ $mas_section_delete_id = array();
+ if (count($_GET['section_delete_id']) > 0)
+ {
+ foreach ($_GET['section_delete_id'] as $val)
+ {
+ $mas_section_delete_id[] = $val;
+ }
+ }
+ $program_id = $_GET['program_id'];
+ $program_manufacturer = $_GET['program_manufacturer'];
+ $program_name = $_GET['program_name'];
+ $program_description = $_GET['program_description'];
+ if ($_GET['save_program'] == "save")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "UPDATE program SET manufacturer = '". $program_manufacturer. "', name = '". $program_name. "', description = '". $program_description. "' WHERE id = ". $program_id;
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные о программе успешно обновлены<br/>";
+ }
+ else
+ {
+ echo "Данные о программе не обновлены<br/>";
+ }
+ if (count($mas_section_insert_id) <> 0)
+ {
+ for ($i = 0; $i < count($mas_section_insert_id); $i++)
+ {
+ $sql = "INSERT INTO prog_in_sect(pid, sid) values ('". $program_id. "','". $mas_section_insert_id[$i]. "');";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу prog_in_sect успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу prog_in_sect не внесены<br/>";
+ }
+ }
+ }
+ if (count($mas_section_delete_id) <> 0)
+ {
+ for ($i = 0; $i < count($mas_section_delete_id); $i++)
+ {
+ $sql = "DELETE FROM prog_in_sect WHERE pid = ". $program_id. " and sid =". $mas_section_delete_id[$i];
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные из таблицы prog_in_sect успешно удалены<br/>";
+ }
+ else
+ {
+ echo "Данные из таблицы prig_in_sect не удалены<br/>";
+ }
+ }
+ }
+ mysql_close($db);
+ }
+ if ($_GET['delete_program'] == "delete")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id FROM prog_in_sect WHERE pid = '". $program_id. "'";
+ $query=mysql_query($sql, $db);
+ if (mysql_num_rows($query))
+ echo "<br/>Ошибка!!! Программа содержится в группе!!!<br/>";
+ else
+ {
+ $sql = "DELETE FROM program WHERE id = ". $program_id;
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Программа успешно удалена<br/>";
+ }
+ else
+ {
+ echo "Программа не удалена<br/>";
+ }
+ }
+ mysql_close($db);
+ }
+ include "foot.php";
+?>
/trunk/edit_program_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/search_program.php
===================================================================
--- trunk/search_program.php (revision 0)
+++ trunk/search_program.php (revision 2)
@@ -0,0 +1,24 @@
+<?php
+ include "head.php";
+ print "
+ <form action = \"search_program_sql.php\">
+ <table>
+ <tr>
+ <td>
+ Введите строку поиска
+ </td>
+ <td>
+ <input type = \"text\" class = \"text\" name = \"search\"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ <input type = \"submit\" class = \"submit\" value = \"Поиск\"/>
+ </td>
+ </tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/search_program.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/program_in_section_windows_only.php
===================================================================
--- trunk/program_in_section_windows_only.php (revision 0)
+++ trunk/program_in_section_windows_only.php (revision 2)
@@ -0,0 +1,57 @@
+<?PHP
+ include "head.php";
+ print "<h1 align = \"center\">Нот арбайтен!</h1><br/>";
+ $section = $_GET['section'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id, name FROM section";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $mas_prog_name = array();
+ $mas_prog_mswindows = array();
+ $mas_prog_linux= array();
+ $mas_prog_id = array();
+ $num_program = array();
+ $mas_prog_in_sect = array();
+ $num_section = mysql_num_rows($query);
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ }
+ for ($j = 0; $j < $num_section; $j++)
+ {
+ $sql = "SELECT pid FROM prog_in_sect WHERE sid = ". $mas_section_id[$j]. ";";
+ $query = mysql_query($sql, $db);
+ $num_program[$j] = mysql_num_rows($query);
+ for ($i = 0; $i < $num_program[$j]; $i++)
+ {
+ $mas_prog_id[$j][$i] = mysql_result($query,$i,0);
+ }
+ for ($i = 0; $i < $num_program[$j]; $i++)
+ {
+ $sql = "SELECT name FROM program WHERE id = ". $mas_prog_id[$j][$i]. ";";
+ $query=mysql_query($sql, $db);
+ $mas_prog_name[$j][$i] = mysql_result($query,0,0);
+ }
+ }
+ mysql_close($db);
+ print "
+ <table align = \"center\" width = \"100%\">
+ <tr><td width = \"33%\"></td><td width = \"33%\"><b>Платные программы</b></td><td><b>Бесплатный программы аналоги</b></td></tr>";
+ for ($j = 0; $j < $num_section; $j++)
+ {
+ print "<tr><td><br/></td><td></td><td></td></tr>";
+ print "<tr><td width = \"33%\"><b>$mas_section_name[$j]</b></td><td width = \"33%\">";
+ print "</td><td>";
+ for($i=0; $i < $num_program[$j]; $i++)
+ {
+ echo $mas_prog_name[$j][$i]. "<br/>";
+ }
+ print "</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
/trunk/program_in_section_windows_only.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_program_url_sql.php
===================================================================
--- trunk/insert_program_url_sql.php (revision 0)
+++ trunk/insert_program_url_sql.php (revision 2)
@@ -0,0 +1,29 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $program_id = $_GET['program_id'];
+ $program_url_url = $_GET['program_url_url'];
+ $program_url_description = $_GET['program_url_description'];
+ $program_url_local_mirror = $_GET['program_url_local_mirror'];
+ if ($program_url_local_mirror <> "1")
+ $program_url_local_mirror = 0;
+ print $_GET['insert_program_url'];
+ if ($_GET['insert_program_url'] == "Сохранить")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "INSERT INTO url(pid, url, description, local_mirror) values ('". $program_id. "','". $program_url_url. "','". $program_url_description. "','". $program_url_local_mirror. "');";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу URL успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу URL не внесены<br/>";
+ }
+ }
+ include "foot.php";
+?>
/trunk/insert_program_url_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/del_program_url_sql.php
===================================================================
--- trunk/del_program_url_sql.php (revision 0)
+++ trunk/del_program_url_sql.php (revision 2)
@@ -0,0 +1,22 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $program_id = $_GET['program_id'];
+ $url_id = $_GET['url_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "DELETE FROM url WHERE id = ". $url_id;
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>URL успешно удален<br/>";
+ }
+ else
+ {
+ echo "URL не удален<br/>";
+ }
+ mysql_close($db);
+ include "foot.php";
+?>
/trunk/del_program_url_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_section.php
===================================================================
--- trunk/view_section.php (revision 0)
+++ trunk/view_section.php (revision 2)
@@ -0,0 +1,23 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name, description FROM section ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_section_id[] = mysql_result($query,$i,0);
+ $mas_section_name[] = mysql_result($query,$i,1);
+ $mas_section_description[] = mysql_result($query,$i,2);
+ }
+ mysql_close($db);
+ print "<table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\"><tr><td><b>Название разделов</b></td><td><b>Описание</b></td><tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ echo "<tr><td bgcolor = \"ffffff\"><a href = view_section_wood.php?section_id=". $mas_section_id[$i]. ">". $mas_section_name[$i]. "</a></td><td bgcolor = \"ffffff\">". $mas_section_description[$i];
+ }
+ print "</tr></table>";
+ include "foot.php";
+?>
/trunk/view_section.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_template.php
===================================================================
--- trunk/insert_template.php (revision 0)
+++ trunk/insert_template.php (revision 2)
@@ -0,0 +1,45 @@
+<?PHP
+//Проверяем авторизацию
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id, manufacturer, name, description FROM program ORDER BY name";
+ $query=mysql_query($sql, $db);
+ $mas_program_id = array();
+ $mas_program_manufacturer = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ $num_record = mysql_num_rows($query);
+
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ $mas_program_manufacturer[] = mysql_result($query, $i, 1);
+ $mas_program_name[] = mysql_result($query, $i, 2);
+ $mas_program_description[] = mysql_result($query, $i, 3);
+ }
+
+ print "
+ <form action = \"insert_template_sql.php\">
+ <p align = \"center\"><b><h3>Полный список программ:</h3></b></p>
+ <table>";
+ for ($i = 0; $i < count($mas_program_id); $i++)
+ {
+ print "<tr><td><input type = \"checkbox\" name = \"mas_program_id[]\" value = \"$mas_program_id[$i]\">$mas_program_name[$i]</input></td>";
+ print "<td>$mas_program_manufacturer[$i]</td></tr>";
+ }
+ print "
+ </table>
+ <table>
+ <tr><td><b>Имя шаблона:</b></td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"template_name\" value = \"\"/></td></tr>
+ <tr><td><br/><input type = \"submit\" class = \"submit\" name = \"create_template\" value = \"create\"/></td>
+ <td><br/><input type = \"submit\" class = \"submit\" name = \"cancel\" value = \"cancel\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
/trunk/insert_template.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/auth.php
===================================================================
--- trunk/auth.php (revision 0)
+++ trunk/auth.php (revision 2)
@@ -0,0 +1,29 @@
+<?PHP
+ $login = $_POST['login'];
+ $password = $_POST['password'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT password, privileges FROM user WHERE login = '". $login. "'";
+ $query=mysql_query($sql, $db);
+ if (!mysql_num_rows($query))
+ {
+ echo "<h3>Имя пользователя или пароль не совпадают!!! Попробуйте еще раз.</h3>";
+ exit;
+ };
+
+ $cryptpassword = mysql_result($query,$i,0);
+ $privileges = mysql_result($query,$i,1);
+ if (crypt($password, $cryptpassword) <> $cryptpassword)
+ {
+ echo "<h3>Имя пользователя или пароль не совпадают!!! Попробуйте еще раз.</h3>";
+ exit;
+ }
+ mysql_close($db);
+ session_start();
+ session_register("user_login");
+ $_SESSION['$user_login'] = $login;
+ $_SESSION['$user_privileges'] = $privileges;
+ header("Location: index.php");
+ ?>
+
\ No newline at end of file
/trunk/auth.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_program.php
===================================================================
--- trunk/view_program.php (revision 0)
+++ trunk/view_program.php (revision 2)
@@ -0,0 +1,31 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name, description FROM program ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query,$i,0);
+ $mas_program_name[$i] = mysql_result($query,$i,1);
+ $mas_program_description[$i] = mysql_result($query,$i,2);
+ }
+ mysql_close($db);
+ print "
+ <table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\">
+ <tr>
+ <td><b>Название программы</b></td>
+ <td><b>Описание</b></td>
+ </tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ print "<tr><td bgcolor = \"ffffff\"><a href = what_is_the_program.php?program_id=$mas_program_id[$i]>$mas_program_name[$i]</td><td bgcolor = \"ffffff\">$mas_program_description[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
+
/trunk/view_program.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_program_edit.php
===================================================================
--- trunk/view_program_edit.php (revision 0)
+++ trunk/view_program_edit.php (revision 2)
@@ -0,0 +1,31 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name, description FROM program ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query,$i,0);
+ $mas_program_name[$i] = mysql_result($query,$i,1);
+ $mas_program_description[$i] = mysql_result($query,$i,2);
+ }
+ mysql_close($db);
+ print "
+ <table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\">
+ <tr>
+ <td><b>Название программы</b></td>
+ <td><b>Описание</b></td>
+ </tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ print "<tr><td bgcolor = \"ffffff\"><a href = edit_program.php?program_id=$mas_program_id[$i]>$mas_program_name[$i]</td><td bgcolor = \"ffffff\">$mas_program_description[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
+
/trunk/view_program_edit.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/foot.php
===================================================================
--- trunk/foot.php (revision 0)
+++ trunk/foot.php (revision 2)
@@ -0,0 +1,5 @@
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
/trunk/foot.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/logout.php
===================================================================
--- trunk/logout.php (revision 0)
+++ trunk/logout.php (revision 2)
@@ -0,0 +1,5 @@
+<?PHP
+ session_start();
+ session_destroy();
+ header("Location: index.php");
+?>
/trunk/logout.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_section.php
===================================================================
--- trunk/edit_section.php (revision 0)
+++ trunk/edit_section.php (revision 2)
@@ -0,0 +1,28 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $section_id = $_GET['section_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT name, description FROM section WHERE id = ". $section_id;
+ $query=mysql_query($sql, $db);
+ $section_name = mysql_result($query,0,0);
+ $section_description = mysql_result($query,0,1);
+
+ print "
+ <table>
+ <tr><td><form action = \"edit_section_sql.php\"></td></tr>
+ <tr><td><input type = \"hidden\" name = \"section_id\" value = \"$section_id\"/></td></tr>
+ <tr><td>Название раздела</td></tr>
+ <tr><td><input type = \"text\" class = \"text\" size = \"25\" name = \"section_name\" value = \"$section_name\"/></td></tr>
+ <tr><td>Описание раздела</td></tr>
+ <tr><td><textarea cols = \"25\" name = \"section_description\" rows = \"4\">$section_description</textarea></td></tr>
+ <tr><td><input type = \"submit\" name = \"delete_section\" class = \"submit\" value = \"delete\"/>
+ <input type = \"submit\" name = \"save_section\" class = \"submit\" value = \"save\"/></td></tr>
+ <tr><td></table></td></tr>
+ </form>";
+ include "foot.php";
+?>
/trunk/edit_section.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_program.php
===================================================================
--- trunk/edit_program.php (revision 0)
+++ trunk/edit_program.php (revision 2)
@@ -0,0 +1,101 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ include "config.php";
+ $program_id = $_GET['program_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT manufacturer, name, description FROM program WHERE id = ". $program_id;
+ $query=mysql_query($sql, $db);
+ $program_manufacturer = mysql_result($query,0,0);
+ $program_name = mysql_result($query,0,1);
+ $program_description = mysql_result($query,0,2);
+ $sql = "SELECT id, url, description FROM url WHERE pid = ". $program_id. " ORDER BY description";
+ $query = mysql_query($sql, $db);
+ $mas_url_id = array();
+ $mas_url_url = array();
+ $mas_url_description = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_url_id[] = mysql_result($query, $i, 0);
+ $mas_url_url[] = mysql_result($query, $i, 1);
+ $mas_url_description[] = mysql_result($query, $i, 2);
+ }
+
+
+ print "
+ <form action = \"edit_program_sql.php\">
+ <table>
+ <tr><td valign = \"top\">
+ <table align = \"center\">
+ <tr><td colspan = \"2\" align = \"center\"><b>Общие данные о программе:</b></td></tr>
+ <tr><td><input type = \"hidden\" name = \"program_id\" value = \"$program_id\"/></td><td></td></tr>
+ <tr><td>Производитель</td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_manufacturer\" value = \"$program_manufacturer\"/></td></tr>
+ <tr><td>Название программы</td><td><input type = \"text\" class = \"text\" size = \"40\" name = \"program_name\" value = \"$program_name\"/></td></tr>
+ <tr><td>Описание программы</td><td><textarea cols = \"40\" name = \"program_description\" rows = \"6\">$program_description</textarea></td></tr>
+ </table>
+ </td>
+ <td valign = \"top\">
+ <table>";
+ print "<tr><td align = \"center\"><b>URL связанные с программой:</b></td></tr>";
+ for ($i = 0; $i < count($mas_url_url); $i++)
+ {
+ print "
+ <tr><td><a href = \"$base_url_software$mas_url_url[$i]\">$mas_url_description[$i]</td>
+ <td><a href = \"edit_program_url.php?program_id=$program_id&url_id=$mas_url_id[$i]\"><img width=\"16\" height=\"16\" src=\"image/edit.png\" alt=\"\"/></a></td>
+ <td><a href = \"del_program_url_sql.php?url_id=$mas_url_id[$i]\"><img src=\"image/del.png\" alt=\"\"/></a></td></tr>";
+ }
+ print "
+ <tr><td align = \"center\" colspan = \"3\"><hr/></td></tr>
+ <tr><td align = \"center\" colspan = \"3\"><a href = \"insert_program_url.php?program_id=$program_id\">Добавить новый URL</a></td></tr></table>
+ </td></tr>
+ </table>";
+
+
+ $sql = "SELECT sid FROM prog_in_sect WHERE pid = ". $program_id;
+ $query=mysql_query($sql, $db);
+ $mas_sect_id = array();
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_sect_id[$i] = mysql_result($query,$i,0);
+ $sql = "SELECT id, name FROM section ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $num_record = mysql_num_rows($query);
+ $mas_prog_in_sect = array();
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ $mas_prog_in_sect[$i] = "";
+ }
+ mysql_close($db);
+ for ($i = 0; $i < count($mas_prog_in_sect_id); $i++)
+ for ($j = 0; $j < count($mas_section_id); $j++)
+ if ($mas_prog_in_sect_id[$i] == $mas_section_id[$j])
+ $mas_prog_in_sect[$j] = "checked";
+ print "
+ <table>
+ <tr><td width = \"50%\"><b>В эти группы программа еще не входит:</b></td><td width = \"50%\"><b>В эти группы программа уже входит</b>:</td></tr>
+ <tr><td>";
+ for ($i = 0; $i < count($mas_section_id); $i++)
+ if ($mas_prog_in_sect[$i] <> "checked")
+ print "<input type = \"checkbox\" name = \"section_insert_id[]\" value = \"$mas_section_id[$i]\">$mas_section_name[$i]</input><br/>";
+ print "</td><td>";
+ for ($i = 0; $i < count($mas_section_id); $i++)
+ if ($mas_prog_in_sect[$i] == "checked")
+ print "<input type = \"checkbox\" name = \"section_delete_id[]\" value = \"$mas_section_id[$i]\" >$mas_section_name[$i]</input><br/>";
+ print "
+ </td></tr></table>
+ <table>
+ <tr><td><br/><input type = \"submit\" class = \"submit\" name = \"delete_program\" value = \"delete\"/></td>
+ <td><br/><input type = \"submit\" class = \"submit\" name = \"save_program\" value = \"save\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
/trunk/edit_program.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_program_url_sql.php
===================================================================
--- trunk/edit_program_url_sql.php (revision 0)
+++ trunk/edit_program_url_sql.php (revision 2)
@@ -0,0 +1,26 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $program_id = $_GET['program_id'];
+ $url_id = $_GET['url_id'];
+ $program_url_url = $_GET['program_url_url'];
+ $program_url_description = $_GET['program_url_description'];
+ if ($_GET['save_program_url'] == "Сохранить")
+ {
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "UPDATE url SET url = '". $program_url_url. "', description = '". $program_url_description. "' WHERE id = '". $url_id. "'";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные об URL успешно обновлены<br/>";
+ }
+ else
+ {
+ echo "Данные об URL не обновлены<br/>";
+ }
+ }
+ include "foot.php";
+?>
/trunk/edit_program_url_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_program_url.php
===================================================================
--- trunk/insert_program_url.php (revision 0)
+++ trunk/insert_program_url.php (revision 2)
@@ -0,0 +1,35 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $program_id = $_GET['program_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT manufacturer, name, description FROM program WHERE id = ". $program_id;
+ $query=mysql_query($sql, $db);
+ $program_manufacturer = mysql_result($query,0,0);
+ $program_name = mysql_result($query,0,1);
+ $program_description = mysql_result($query,0,2);
+
+ print "
+ <form action = \"insert_program_url_sql.php\">
+ <table align = \"center\">
+ <tr><td colspan = \"2\" align = \"center\"><b>Общие данные о программе:</b></td></tr>
+ <tr><td><input type = \"hidden\" name = \"program_id\" value = \"$program_id\"/></td><td></td></tr>
+ <tr><td>Производитель</td><td><input type = \"text\" class = \"text\" size = \"25\" value = \"$program_manufacturer\" disabled = \"true\"/></td></tr>
+ <tr><td>Название программы</td><td><input type = \"text\" class = \"text\" size = \"25\" value = \"$program_name\" disabled = \"true\"/></td></tr>
+ <tr><td>Описание программы</td><td><textarea cols = \"25\" rows = \"4\" disabled = \"true\">$program_description</textarea></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><br/></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><b>Добавляемый URL:</b></td></tr>
+ <tr><td align = \"center\"><b>Описание:</b></td><td align = \"center\"><b>URL:</b></td></tr>
+ <tr><td><input type = \"input\" class = \"text\" name = \"program_url_description\"></input></td>
+ <td><input type = \"input\" class = \"text\" name = \"program_url_url\" size = \"25\"></input></td></tr>
+ <tr><td><input type = \"checkbox\" name = \"program_url_local_mirror\" value = \"1\">Локальное зеркало?</input></td><td></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><br/></td></tr>
+ <tr><td></td><td align = \"right\"><input type = \"submit\" class = \"submit\" name = \"insert_program_url\" value = \"Сохранить\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/insert_program_url.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_new_section_sql.php
===================================================================
--- trunk/insert_new_section_sql.php (revision 0)
+++ trunk/insert_new_section_sql.php (revision 2)
@@ -0,0 +1,23 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $section_name = $_GET['section_name'];
+ $section_description = $_GET['section_description'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_query("SET NAMES 'utf8';", $db);
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "INSERT INTO section(name, description) values ('". $section_name. "','". $section_description. "')";
+ if (mysql_query($sql, $db))
+ {
+ echo "Данные успешно внесены";
+ }
+ else
+ {
+ echo "Данные не внесены";
+ }
+ mysql_close($db);
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/insert_new_section_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/search_program_edit_sql.php
===================================================================
--- trunk/search_program_edit_sql.php (revision 0)
+++ trunk/search_program_edit_sql.php (revision 2)
@@ -0,0 +1,77 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $search = $_GET['search'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+
+ $sql = "SELECT id, name, description FROM program WHERE name like '%". $search. "%' or description like '%". $search. "%' ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $num_program = mysql_num_rows($query);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ for ($i = 0; $i < $num_program; $i++)
+ {
+ $mas_program_id[$i] = mysql_result($query, $i, 0);
+ $mas_program_name[$i] = mysql_result($query, $i, 1);
+ $mas_program_description[$i] = mysql_result($query, $i, 2);
+ }
+
+ $sql = "SELECT id, name, description FROM section WHERE name like '%". $search. "%' or description like '%". $search. "%' ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $num_section = mysql_num_rows($query);
+ $mas_section_id = array();
+ $mas_section_name = array();
+ $mas_section_description = array();
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ $mas_section_id[$i] = mysql_result($query, $i, 0);
+ $mas_section_name[$i] = mysql_result($query, $i, 1);
+ $mas_section_description[$i] = mysql_result($query, $i, 2);
+ }
+ mysql_close($db);
+ print "
+ <p><b>Найденные группы:</b></p>
+ <hr/>
+ <table width = \"100%\">
+ <tr>
+ <td><b>Название группы</b></td>
+ <td><b>Описание</b></td>
+ </tr>
+ <tr>
+ <td><br/></td>
+ <td><br/></td>
+ </tr>";
+ for ($i = 0; $i < $num_section; $i++)
+ {
+ print "
+ <tr><td><a href = edit_section.php?section_id=$mas_section_id[$i]>$mas_section_name[$i]</td>
+ <td>$mas_section_description[$i]</td></tr>";
+ }
+ print "</table>";
+
+ print "
+ <p><b>Найденные программы:</b></p>
+ <hr/>
+ <table width = \"100%\">
+ <tr>
+ <td><b>Название программы</b></td>
+ <td><b>Описание</b></td>
+ </tr>
+ <tr>
+ <td><br/></td>
+ <td><br/></td>
+ </tr>";
+ for ($i = 0; $i < $num_program; $i++)
+ {
+ #echo "<tr><td class = \"border-tb\">$mas_program_name[$i]</td></tr>";
+ print "
+ <tr><td><a href = edit_program.php?program_id=$mas_program_id[$i]>$mas_program_name[$i]</td>
+ <td>$mas_program_description[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
/trunk/search_program_edit_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/insert_new_program_sql.php
===================================================================
--- trunk/insert_new_program_sql.php (revision 0)
+++ trunk/insert_new_program_sql.php (revision 2)
@@ -0,0 +1,82 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $mas_section_insert_id = array();
+ if (count($_GET['section_insert_id']) > 0)
+ {
+ foreach ($_GET['section_insert_id'] as $val)
+ {
+ $mas_section_insert_id[] = $val;
+ }
+ }
+ $program_manufacturer = $_GET['program_manufacturer'];
+ $program_site = $_GET['program_site'];
+ $program_mirror = $_GET['program_mirror'];
+ $program_name = $_GET['program_name'];
+ $program_description = $_GET['program_description'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT id, name FROM program WHERE name = '". $program_name. "'";
+ $query=mysql_query($sql, $db);
+ if (mysql_num_rows($query))
+ echo "<br/>Ошибка!!! Программа с таким именем уже существует!!!<br/>";
+ else
+ {
+ $sql = "INSERT INTO program(manufacturer, name, description) values ('". $program_manufacturer. "','". $program_name. "','". $program_description. "')";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные о программе успешно добавлены<br/>";
+ }
+ else
+ {
+ echo "Данные о программе не добавлены<br/>";
+ }
+ $sql = "SELECT id FROM program WHERE manufacturer = '". $program_manufacturer. "' and name = '". $program_name. "';";
+ $query=mysql_query($sql, $db);
+ $program_id = mysql_result($query, 0, 0);
+ if (count($mas_section_insert_id) <> 0)
+ {
+ for ($i = 0; $i < count($mas_section_insert_id); $i++)
+ {
+ $sql = "INSERT INTO prog_in_sect(pid, sid) values ('". $program_id. "','". $mas_section_insert_id[$i]. "');";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу prog_in_sect успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу prog_in_sect не внесены<br/>";
+ }
+ }
+ }
+ if ($program_site <> "")
+ {
+ $sql = "INSERT INTO url(pid, url, description) values ('". $program_id. "','". $program_site. "','". "Сайт программы". "');";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу URL успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу URL не внесены<br/>";
+ }
+ }
+ if ($program_mirror <> "")
+ {
+ $sql = "INSERT INTO url(pid, url, description, local_mirror) values ('". $program_id. "','". $program_mirror. "','". "Локальное зеркало". "', 1);";
+ if (mysql_query($sql, $db))
+ {
+ echo "<br/>Данные в таблицу URL успешно внесены<br/>";
+ }
+ else
+ {
+ echo "Данные в таблицу URL не внесены<br/>";
+ }
+ }
+ mysql_close($db);
+ }
+ include "foot.php";
+?>
/trunk/insert_new_program_sql.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/misc_view.php
===================================================================
--- trunk/misc_view.php (revision 0)
+++ trunk/misc_view.php (revision 2)
@@ -0,0 +1,9 @@
+<?PHP
+ include "head.php";
+ print "
+ <table>
+ <tr><td><img src=\"style/bullet.gif\"><a href = \"program_in_section.php\">Список по группам</></td></tr>
+ <tr><td><img src=\"style/bullet.gif\"><a href = \"program_in_section_windows_only.php\">Список по группам (только MSWindows)</></td></tr>
+ </table>";
+ include "foot.php";
+?>
/trunk/misc_view.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_iso_and_zip.php
===================================================================
--- trunk/view_iso_and_zip.php (revision 0)
+++ trunk/view_iso_and_zip.php (revision 2)
@@ -0,0 +1,12 @@
+<?PHP
+ include "head.php";
+ include "config.php";
+ $h=opendir($template_dir);
+ while(($f=readdir($h))!==false)
+ {
+ echo "<a href=\"". "$base_url_templates". "$f\">$f</a>";
+ echo "<br>";
+ };
+ include "foot.php";
+?>
+
/trunk/view_iso_and_zip.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/create_index.php
===================================================================
--- trunk/create_index.php (revision 0)
+++ trunk/create_index.php (revision 2)
@@ -0,0 +1,90 @@
+<?PHP
+ print "
+ <html>
+ <head>
+ <title></title>
+ <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=UTF-8\">
+ <META NAME=\"keywords\" CONTENT=\"\">
+ <META NAME=\"description\" CONTENT=\"\">
+ <LINK rel=stylesheet href=\"style/menu.css\" type=\"text/css\">
+ </head>
+ <body>";
+//Проверяем авторизацию
+# session_start();
+# if ($_SESSION['$user_privileges'] < 16)
+# header("Location: index.php");
+ include "config.php";
+ $template_id = $_GET['template_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+
+ //Загружем данные шаблона
+ $sql = "SELECT name FROM templates WHERE id = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $template_name = mysql_result($query,0,0);
+
+ //Загружаем таблицу программ входящих в шаблон
+ $sql = "SELECT pid FROM prog_in_temp WHERE tid = ". $template_id;
+ $query=mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ for($i = 0; $i < $num_record; $i++)
+ $mas_prog_in_temp_id[$i] = mysql_result($query,$i,0);
+ $sql_part = "('". $mas_prog_in_temp_id[0];
+ for ($i = 1; $i < count($mas_prog_in_temp_id); $i++)
+ {
+ $sql_part = $sql_part. "','". $mas_prog_in_temp_id[$i];
+ }
+ $sql_part = $sql_part. "')";
+ $sql = "SELECT id, name, description FROM program WHERE id in ". $sql_part. " ORDER BY name";
+ $query = mysql_query($sql, $db);
+ $mas_program_id = array();
+ $mas_program_name = array();
+ $mas_program_description = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_program_id[] = mysql_result($query, $i, 0);
+ $mas_program_name[] = mysql_result($query, $i, 1);
+ $mas_program_description[] = mysql_result($query, $i, 2);
+ }
+
+ //Загружем таблицу урлов для программ данного шаблона
+ $sql = "SELECT id, pid, description,url FROM url WHERE pid in ". $sql_part;
+ $query = mysql_query($sql, $db);
+ $mas_url_id = array();
+ $mas_url_pid = array();
+ $mas_url_description = array();
+ $mas_url_url = array();
+ $num_record = mysql_num_rows($query);
+ for ($i = 0; $i < $num_record; $i++)
+ {
+ $mas_url_id[] = mysql_result($query, $i, 0);
+ $mas_url_pid[] = mysql_result($query, $i, 1);
+ $mas_url_description[] = mysql_result($query, $i, 2);
+ $mas_url_url[] = mysql_result($query, $i, 3);
+ }
+
+ print "
+ <table>
+ <tr><td><b>Полный список программ:</b></td><td><b>Описание программы</b></td><td><b>Связанные ссылки:</b></td></tr>";
+ for ($i = 0; $i < count($mas_program_id); $i++)
+ {
+ print "<tr><td>$mas_program_name[$i]</td><td>$mas_program_description[$i]</td><td>";
+ for($j = 0; $j < count($mas_url_id); $j++)
+ {
+ if ($mas_url_pid[$j] == $mas_program_id[$i])
+ {
+ print "<a href = \"$mas_url_url[$j]\">$mas_url_description[$j]</a><br/>";
+ }
+ }
+ print "</td></tr>";
+ "</tr>";
+ }
+ print "
+ </td>
+ </tr>
+ </table>
+ </body>
+ </html>";
+?>
/trunk/create_index.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/view_templates_edit.php
===================================================================
--- trunk/view_templates_edit.php (revision 0)
+++ trunk/view_templates_edit.php (revision 2)
@@ -0,0 +1,27 @@
+<?PHP
+ include "head.php";
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $query=mysql_query("SELECT id, name FROM templates ORDER BY name;", $db);
+ $numrecord = mysql_num_rows($query);
+ $mas_templates_id = array();
+ $mas_templates_name = array();
+ for ($i = 0; $i < $numrecord; $i++)
+ {
+ $mas_templates_id[$i] = mysql_result($query,$i,0);
+ $mas_templates_name[$i] = mysql_result($query,$i,1);
+ }
+ mysql_close($db);
+ print "
+ <table width = \"100%\" class = \"without-border\" cellpadding = \"0\" cellspacing = \"1\" bgcolor = \"cccccc\">
+ <tr>
+ <td><b>Название шаблона</b></td>
+ </tr>";
+ for($i=0; $i < $numrecord; $i++)
+ {
+ print "<tr><td bgcolor = \"ffffff\"><a href = edit_template.php?template_id=$mas_templates_id[$i]>$mas_templates_name[$i]</td></tr>";
+ }
+ print "</table>";
+ include "foot.php";
+?>
/trunk/view_templates_edit.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/edit_program_url.php
===================================================================
--- trunk/edit_program_url.php (revision 0)
+++ trunk/edit_program_url.php (revision 2)
@@ -0,0 +1,41 @@
+<?PHP
+ session_start();
+ if ($_SESSION['$user_privileges'] < 16)
+ header("Location: index.php");
+ include "head.php";
+ $program_id = $_GET['program_id'];
+ $url_id = $_GET['url_id'];
+ $db = mysql_connect("localhost", "linwin");
+ mysql_select_db("linwin", $db);
+ mysql_query("SET NAMES 'utf8';", $db);
+ $sql = "SELECT manufacturer, name, description FROM program WHERE id = ". $program_id;
+ $query=mysql_query($sql, $db);
+ $program_manufacturer = mysql_result($query,0,0);
+ $program_name = mysql_result($query,0,1);
+ $program_description = mysql_result($query,0,2);
+
+ $sql = "SELECT url, description FROM url WHERE id = ". $url_id;
+ $query = mysql_query($sql, $db);
+ $num_record = mysql_num_rows($query);
+ $url_url = mysql_result($query, $i, 0);
+ $url_description = mysql_result($query, $i, 1);
+
+ print "
+ <form action = \"edit_program_url_sql.php\">
+ <table align = \"center\">
+ <tr><td colspan = \"2\" align = \"center\"><b>Общие данные о программе:</b></td></tr>
+ <tr><td><input type = \"hidden\" name = \"program_id\" value = \"$program_id\"/></td><td></td></tr>
+ <tr><td><input type = \"hidden\" name = \"url_id\" value = \"$url_id\"/></td><td></td></tr>
+ <tr><td>Производитель</td><td><input type = \"text\" class = \"text\" size = \"25\" value = \"$program_manufacturer\" disabled = \"true\"/></td></tr>
+ <tr><td>Название программы</td><td><input type = \"text\" class = \"text\" size = \"25\" value = \"$program_name\" disabled = \"true\"/></td></tr>
+ <tr><td>Описание программы</td><td><textarea cols = \"25\" rows = \"4\" disabled = \"true\">$program_description</textarea></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><br/></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><b>Редактируемый URL:</b></td></tr>
+ <tr><td><input type = \"input\" class = \"text\" name = \"program_url_description\" value = \"$url_description\"></input></td>
+ <td><input type = \"input\" class = \"text\" name = \"program_url_url\" size = \"25\" value = \"$url_url\"></input></td></tr>
+ <tr><td align = \"center\" colspan = \"2\"><br/></td></tr>
+ <tr><td></td><td align = \"right\"><input type = \"submit\" class = \"submit\" name = \"save_program_url\" value = \"Сохранить\"/></td></tr>
+ </table>
+ </form>";
+ include "foot.php";
+?>
\ No newline at end of file
/trunk/edit_program_url.php
Изменения свойств:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property