diff --git a/contacts.php b/contacts.php
index fb51dd0..5c5ef5e 100644
--- a/contacts.php
+++ b/contacts.php
@@ -2,86 +2,59 @@
ob_start("ob_gzhandler");
session_start();
if ($_SESSION['uid'] == null) header("Location: index.php");
+require_once 'config.php';
-require_once 'functions.php';
-$friend = db::c()->query('SELECT * FROM `friends` WHERE `user` = ?i', $_SESSION['uid'])->fetch_assoc();
+if (input::post('friendadd')) {
+ $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendadd'))->fetch_assoc();
+ $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
-if ($_POST['sd4'] && $_POST['friendadd']) {
- $_POST['friendadd'] = htmlspecialchars($_POST['friendadd'], NULL, 'cp1251');
- if (preg_match('/^[- \p{L}\d]+$/u', $_POST['friendadd'])) $status = 'Персонаж не найден.';
- else $igogo = mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE `login` = '{$_POST['friendadd']}' LIMIT 1;"));
-
- $_POST['comment'] = htmlspecialchars($_POST['comment'], NULL, "");
- $igogo2 = mysql_fetch_array(mysql_query("SELECT friend FROM `friends` WHERE `user` = '" . $user['id'] . "' and `friend`=" . $igogo['id'] . " LIMIT 1;"));
- if (!$igogo['id']) $status = 'Персонаж не найден.';
- elseif ($igogo['id'] == $user['id']) $status = 'Себя добавить нельзя.';
- elseif (preg_match('/^[- \p{L}\d]+$/u', $_POST['comment'])) $status = 'Ошибка ввода: запрещённые символы!';
- elseif ($igogo2['friend']) $status = 'Персонаж уже есть в списке.';
+ if (!$q['id']) $status = 'Персонаж не найден.';
+ elseif ($q['id'] == $_SESSION['uid']) $status = 'Себя добавить нельзя.';
+ elseif ($q2->getNumRows()) $status = 'Персонаж уже есть в списке.';
else {
- if ($_POST['group'] == 0) $friend = $igogo['id'];
-
- mysql_query("INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES(" . $user['id'] . ", " . $friend . ", '" . $_POST['comment'] . "');");
+ db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], input::post('comment'));
$status = 'Контакт добавлен.';
}
}
-if ($_POST['friendremove']) {
- $_POST['friendremove'] = htmlspecialchars($_POST['friendremove'], NULL, 'cp1251');
- if (preg_match('/^[- \p{L}\d]+$/u', $_POST['friendremove'])) $status = 'Персонаж не найден.';
- else $igogo = mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE `login` = '{$_POST['friendremove']}' LIMIT 1;"));
+if (input::post('friendremove')) {
+ $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendremove'))->fetch_assoc();
+ $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
- if (!$igogo['id']) $status = 'Персонаж не найден.';
+ if (!$q['id'] OR !$q2->getNumRows()) $status = 'Персонаж не найден.';
else {
- $igogo2 = mysql_fetch_array(mysql_query("SELECT enemy,friend,notinlist FROM `friends` WHERE `user` = '" . $user['id'] . "' and `friend`=" . $igogo['id'] . " LIMIT 1;"));
- if (!$igogo2['friend']) $status = 'Персонаж не найден.';
- else {
- $per = "`friend`='" . $igogo2['friend'] . "'";
-
- mysql_query("DELETE FROM `friends` WHERE `user`='" . $user['id'] . "' and " . $per . ";");
- $status = 'Контакт удалён.';
- }
+ db::c()->query('DELETE FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
+ $status = 'Контакт удалён.';
}
}
-if ($_POST['friendedit']) {
- $_POST['friendedit'] = htmlspecialchars($_POST['friendedit'], NULL, 'cp1251');
- if (preg_match('/^[- \p{L}\d]+$/u', $_POST['friendedit'])) $status = 'Персонаж не найден.';
- else $igogo = mysql_fetch_array(mysql_query("SELECT id FROM `users` WHERE `login` = '{$_POST['friendedit']}' LIMIT 1;"));
+if (input::post('friendedit')) {
+ $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendedit'))->fetch_assoc();
+ $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
- $_POST['comment'] = htmlspecialchars($_POST['comment'], NULL, "");
-
- if (!$igogo['id']) $status = 'Персонаж не найден.';
- elseif ($igogo['id'] == $user['id']) $status = 'Себя отредактировать нельзя.';
- elseif (preg_match('/^[- \p{L}\d]+$/u', $_POST['comment'])) $status = 'Ошибка ввода: запрещённые символы!';
+ if (!$q2['friend']) $status = 'Персонаж не найден.';
else {
- if ($_POST['group'] == 0) $friend = $igogo['id'];
-
- $igogo2 = mysql_fetch_array(mysql_query("SELECT friend FROM `friends` WHERE `user` = '" . $user['id'] . "' and `friend`=" . $igogo['id'] . " LIMIT 1;"));
- if (!$igogo2['friend']) $status = 'Персонаж не найден.';
- else {
- $per = "`friend`='" . $igogo2['friend'] . "'";
-
- mysql_query("UPDATE `friends` SET `friend` = " . $friend . ",`comment` = " . $_POST['comment'] . " WHERE `user`='" . $user['id'] . "' and " . $per . "");
- $status = 'Контакт изменён.';
- }
+ db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', input::post('comment'), $_SESSION['uid'], $q['id']);
+ $status = 'Контакт изменён.';
}
+
}
$admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login` ASC', (time() - 60));
$contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE `friend` > 0 AND `user` = ?i', $_SESSION['uid']);
?>
+
-
-
-
-
-
+
+
+
@@ -92,7 +65,7 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE
-
+
Контакты |
@@ -107,12 +80,13 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE
else echo "" . nick::id($us['id'])->full() . " ";
?>
-
+ |
= $row['comment'] ?>
|
- ", "= $row['comment'] ?>")'>
+
+
|
endwhile; ?>
@@ -127,8 +101,8 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE
diff --git a/css/friend/design3.css b/css/friend/design3.css
deleted file mode 100644
index 3411cf4..0000000
--- a/css/friend/design3.css
+++ /dev/null
@@ -1,99 +0,0 @@
-body {
- margin: 0px 1px 0px 1px;
- padding: 0px 1px 0px 1px;
- background-color: #dedede;
- color: #000000;
-}
-
-.main_text {
- font-weight: bold;
- font-size: 10px;
- text-decoration: none;
- color:#f0f0f0;
- cursor:hand;
-}
-
-.menutop, a.menutop:visited, a.menutop:active {
- font-weight: bold;
- font-size: 10px;
- text-decoration: none;
- color: #3B3936;
-}
-
-a.menutop:hover {
- color: #76726b;
-}
-
-.name {
- font-weight: bold;
- font-size: 12px;
-}
-
-.parametr_title {
- font-weight: bold;
- font-size: 11px;
- color: #777773;
-}
-
-.prname {
- padding-left: 4px;
- font-size: 11px;
- font-family: Arial, Helvetica, sans-serif;
-}
-
-.prvalue {
- font-size: 11px;
- font-family: Arial, Helvetica, sans-serif;
-}
-
-.btn {
- border: 1px double #9a9996;
- font-size: 12px;
- color: #dfdfdf;
- background-color:#504F4C;
-}
-
-.mainmenu {
- color: #23292C;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-style: solid;
- border-right-style: none;
- border-bottom-style: solid;
- border-left-style: solid;
- border-top-color: #969697;
- border-right-color: #969697;
- border-bottom-color: #000000;
- border-left-color: #969697;
- background-color: #BABABB;
- cursor:hand;
-}
-
-.maptext {
- font-weight: bold;
- font-size: 12px;
- color: #000000;
- font-family: Arial, Helvetica, sans-serif;
-}
-.posit {
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-style: solid;
- border-right-style: solid;
- border-bottom-style: solid;
- border-left-style: solid;
- border-top-color: #FFFFFF;
- border-right-color: #666666;
- border-bottom-color: #666666;
- border-left-color: #FFFFFF;
- padding: 2px;
-}
-
-td {
- font-size: 10pt;
- font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-}
\ No newline at end of file
diff --git a/css/friend/main.css b/css/friend/main.css
deleted file mode 100644
index 8c12988..0000000
--- a/css/friend/main.css
+++ /dev/null
@@ -1,40 +0,0 @@
-body, td, ol, ul, li , p {
- FONT-SIZE: 10pt;
- FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-}
-.text {
- FONT-SIZE: 10pt; COLOR: #000000; FONT-WEIGHT: normal;
- FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-}
-H3 { COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 12pt; FONT-WEIGHT: bold; TEXT-ALIGN: center }
-H4 { COLOR: #8f0000; FONT-FAMILY: Arial; FONT-SIZE: 11pt; FONT-WEIGHT: bold; MARGIN-BOTTOM: 5px;}
-H5 { COLOR: #4f0000; FONT-FAMILY: Arial; FONT-SIZE: 11pt; FONT-WEIGHT: bold; MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px;}
-a,a:visited { text-decoration: none; FONT-WEIGHT: bold; color: #003388; }
-a:active { color: #6F0000}
-a:hover { color: #0066FF}
-.date { font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #007000}
-.date2 { font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #007000; background-color: #00FFAA}
-.sysdate { font-family: Courier; font-size: 8pt; text-decoration:none; font-weight:normal; color: #B00000}
-.private { font-weight:bold; color: red; background-color: #FAE0E0}
-.number { font-size: 11pt; font-weight: bold; color: #6F0000}
-.dsc { color: #606060; font-weight:normal; }
-select,textarea,input { border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;}
-
-.ahint {font-family: MS Sans Serif; font-size:8px; text-decoration:none; color:#000080;z-index: 99;}
-#hint2 {position:absolute; width:140; background-color:#FFF6DD; layer-background-color:#FFF6DD; visibility:hidden}
-#hint3 {position:absolute; width:240; background-color:#FFF6DD; layer-background-color:#FFF6DD; visibility:hidden}
-#hint4 {position:absolute; width:240; visibility:hidden}
-
-.B1 { font-weight: bold; color: #6666CC}
-.B2 { font-weight: bold; color: #B06A00}
-.B3 { font-weight: bold; color: #269088}
-.B4 { font-weight: bold; color: #A0AF20}
-.B5 { font-weight: bold; color: #0F79D3}
-.B6 { font-weight: bold; color: #D85E23}
-.B7 { font-weight: bold; color: #5C832F}
-.B8 { font-weight: bold; color: #842B61}
-.B9 { font-weight: bold; color: navy}
-.Bs1 { font-size: 8pt; font-weight:bold; color: #6666CC}
-.Bs2 { font-weight:bold; color: #B06A00}
-img,table {border:0}
-
diff --git a/css/main.css b/css/main.css
index 7e9e0ad..c0a4895 100644
--- a/css/main.css
+++ b/css/main.css
@@ -75,7 +75,8 @@ SELECT, TEXTAREA, INPUT {
.ahint {
FONT-SIZE: 8px;
COLOR: #000080;
- TEXT-DECORATION: none
+ TEXT-DECORATION: none;
+ z-index: 50;
}
#hint3 {
|