Файл: menu.php
Строк: 666
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('core/start.php');
check_auth();
switch ($select) {
default:
head('Kabinet');
if (empty($_GET['id'])) {
$page = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array(num($_SESSION['user_id'])));
} else {
$page = DB::$dbs->queryFetch("SELECT * FROM ".USERS." WHERE `user_id` = ?",array(num($_GET['id'])));
}
echo '<div class="white"><b> ' . userLink($page['user_id']) . '</b><br/>';
?>
<html>
<body>
<span id="hours" style="font-size:11px;"></span>
<script type="text/javascript">
obj_hours=document.getElementById("hours");
name_month=new Array ("Yanvar","Fevral","Mart", "Aprel","May", "Iyun","Iyul","Avgust","Sentyabr", "Oktyabr","Noyabr","Dekabr");
name_day=new Array ("Yakshanba","Dushanba", "Seshanba","Chorshanba","Payshanba", "Juma","Shanba");
function wr_hours()
{
time=new Date();
time_sec=time.getSeconds();
time_min=time.getMinutes();
time_hours=time.getHours();
time_wr=((time_hours<10)?"0":"")+time_hours;
time_wr+=":";
time_wr+=((time_min<10)?"0":"")+time_min;
time_wr+=":";
time_wr+=((time_sec<10)?"0":"")+time_sec;
time_wr=" Bugun "+name_day[time.getDay()]+", "+time.getDate()+" "+name_month[time.getMonth()]+" "+time.getFullYear()+" y. soat "+time_wr;
obj_hours.innerHTML=time_wr;
}
wr_hours();
setInterval("wr_hours();",1000);
</script>
</body>
</html>
<?php
echo '</div>';
if (!empty($user['level'])) {
echo '<div class="lines">';
echo '<a href="'.HOME.'/panel"><b>Apanel</b></a>';
echo '</div>';
}
echo '<div class="lines">';
echo '<a href="'.HOME.'/menu/anceta">Anketani tahrirlash</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/menu/photo">Avatar</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/shop/">Pullik hizmatlar</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/faq">Ma`lumotlar</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/menu/sett">Sozlamalar</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/menu/style">Sayt ko`rinishlari</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/menu/status">Statuslar</a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/search/">Saytda izlash</a>';
echo '</div>';
$all = DB::$dbs->querySingle("SELECT COUNT(*) FROM ".TOUCH_USER." WHERE `user_id` = ? ", array($user['user_id']));
echo '<div class="lines">';
echo '<a href="'.HOME.'/touch/">Tiket</a> <span class="count"> '.$all.'</span></a>';
echo '</div>';
echo '<div class="lines">';
$all = DB::$dbs->querySingle("SELECT COUNT(`id`) FROM ".BLACKUSERS." WHERE `user_id` = ? ", array($user['user_id']));
echo ' <a href="'.HOME.'/blacklist/">Qora ro`yhat <span class="count"> '.$all.'</span></a>';
echo '</div>';
echo '<div class="lines">';
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `ref` = ?", array($user['user_id']));
echo '<a href="'.HOME.'/menu/ref">Referal tizim<span class="count"> '.$all.' </span></a>';
echo '</div>';
echo '<div class="lines">';
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `level` > ?", array(0));
echo ' <a href="'.HOME.'/admin/" >Sayt ma`muriyati <span class="count">'.$all.'</span></a>';
echo '</div>';
echo '<div class="lines">';
echo '<a href="'.HOME.'/exit">Chiqish</a>';
echo '</div>';
$array = array('Kabinet');
nav($array);
break;
case 'style':
head('Sayt ko`rinishi');
if (isset($_GET['ver'])) {
$ver = trim(htmlspecialchars($_GET['ver']));
if (!is_dir(inc."style/themes/$ver")) {
die('Bunday dizayn yo`q!');
}
DB::$dbs->query("UPDATE ".USERS." SET `style` = ? WHERE `user_id` = ?",array($ver, $user['user_id']));
header("Location: " . HOME . "/");
}
$path_them=opendir(inc.'style/themes/');
while($thems = readdir($path_them)) {
if ($thems=='.' || $thems=='..' || !is_dir(inc."style/themes/$thems")) continue;
$count = DB::$dbs->querySingle("SELECT COUNT(*) FROM `users` WHERE `style` = ?", array($thems));
echo '<table cellspacing="0" cellpadding="0" width="100%" ><tr>
<td class="lines" width="5%">';
echo (file_exists(inc.'style/themes/'.$thems.'/theme.png') ? '<a href="/style/themes/'.$thems.'/theme.png"><img src="/style/themes/'.$thems.'/theme.png" alt="preview" style="width:50px;height:50px;border-radius:55%;"/></a>':'<img="/style/img/theme.png" alt="preview" style="width:50px;height:50px;border-radius:55%;"/>');
echo '</td><td class="lines" width="90%">';
echo '' . ($user['style'] != $thems ? '<a href="/menu/style?ver='.$thems.'">'.trim(file_get_contents(inc.'style/themes/'.$thems.'/name.txt')).'</a>':'<b>'.trim(file_get_contents(inc.'style/themes/'.$thems.'/name.txt')).'</b>').' <br/><span class="mini">'.($thems == $user['style'] ? ' '.$count.' ':' '.$count.' ').' ta foydanuvchida o`rnatilgan</span><br/>';
echo '</td></tr></table>';
}
closedir($path_them);
$array = array('Kabinet');
nav($array);
break;
case 'ref':
head('Referal tizim');
echo DIV_BLOCK . '<b>Taklif qilish uchun sizga manzil:</b><br /><textarea>'.HOME.'/reg/?ref='.$user['user_id'].'</textarea>' . CLOSE_DIV;
$all = DB::$dbs->querySingle("SELECT COUNT(`user_id`) FROM ".USERS." WHERE `ref` = ?", array($user['user_id']));
if (empty($all)) {
echo DIV_BLOCK . 'Ro`yhat bo`sh' . CLOSE_DIV;
} else {
$n = new Navigator($all,10,'');
$sql = DB::$dbs->query("SELECT `user_id`, `recording_date` FROM ".USERS." WHERE `ref` = ? ORDER BY `recording_date` DESC LIMIT {$n->start()}, 10", array($user['user_id']));
while($ank = $sql -> fetch()) {
echo DIV_BLOCK . user_choice($ank['user_id'], 'link') . ' ' . vrem($ank['recording_date']) . CLOSE_DIV;
}
echo $n->navi();
}
echo CLOSE_DIV;
$array = array('Kabinet');
nav($array);
break;
case 'status':
head('Status');
if (!empty($_POST['status'])) {
$status = html($_POST['status']);
if (strlen($status) > 500) {
echo DIV_ERROR . 'Juda uzun status' . CLOSE_DIV;
} else {
DB::$dbs->query("INSERT INTO ".STATUS." (`user_id`, `time`, `status`) VALUES (?, ?, ?)", array($user['user_id'], time(), $status));
if (isset($_GET['ank'])) {
header("Location: ".HOME."/id".$user['user_id']);
} else {
header("Location: ".HOME."/menu/status");
}
}
}
$status = DB::$dbs->queryFetch("SELECT * FROM ".STATUS." WHERE `user_id` = ? ORDER BY `id` DESC LIMIT 1",array($user['user_id']));
echo DIV_AUT;
if (isset($_GET['edit'])) {
echo '<form action="'.HOME.'/menu/status'.(isset($_GET['ank']) ? '?ank' : NULL).'" method="POST">';
echo 'Yangi status [max. 500]<br /><input type="text" name="status" value="'.$status['status'].'"/><input type="submit" value="+"/>';
echo '</form>';
} else {
if (!empty($status)) {
echo '<b>Status:</b> <a href="?edit">'.$status['status'].'</a>';
} else {
echo '<form action="?" method="POST">';
echo 'Yangi status [max. 500]<br /><input type="text" name="status"/><input type="submit" value="+"/>';
echo '</form>';
}
}
echo CLOSE_DIV;
$array = array('Kabinet', 'Status');
nav($array);
break;
case 'photo':
head('Sahifangiz fotosi');
if (!empty($_FILES['file'])) {
$name = $_FILES['file']['name']; # Fayl nomi
$ext = strtolower(strrchr($name, '.')); # Fayl formati
$par = getimagesize($_FILES['file']['tmp_name']); # Rasm shakli
$size = $_FILES['file']['size']; # Fayl hajmi
$photo = $user['user_id'].$ext;
$pictures = array('.jpg', '.jpeg', '.gif', '.png'); # Mumkun bo`lgan formatlar
if ($par[0] > $config['photo_par'][0] || $par[1] > $config['photo_par'][1]) {
$err .= 'Rasm hajmi katta. [Max. '.$config['photo_par'][0].'x'.$config['photo_par'][1].']<br />';
}
if ($size > (1048576 * $config['max_upload_photo'])) {
$err .= 'Rasm hajmi katta. [Max. '.$config['max_upload_photo'].'mb]<br />';
}
if (preg_match('/.php/i', $name) || preg_match('/.pl/i', $name) || $name == '.htaccess' || !in_array($ext, $pictures)) {
$err .= 'Rasm formati xato.<br />';
}
if (empty($err)) {
copy($_FILES['file']['tmp_name'], 'files/photo/'.$user['user_id'].$ext); # Original tarzda yuklaymiz
img_resize('files/photo/'.$user['user_id'].$ext, 'files/photo/mini_'.$user['user_id'].$ext, $config['mini_photo_par'][0], $config['mini_photo_par'][1]); # Mini
DB::$dbs->query("UPDATE ".USERS." SET `photo` = ? WHERE `user_id` = ?", array($photo, $user['user_id']));
DB::$dbs->query("DELETE FROM ".PHOTO_RATING." WHERE `friend_id` = ? ", array($user['user_id']));
DB::$dbs->query("DELETE FROM ".PHOTO_COMM." WHERE `friend_id` = ? ", array($user['user_id']));
header("Location: ".HOME."/menu/photo");
} else {
echo $err;
}
}
if (!empty($_POST['delete'])) {
unlink("files/photo/".$user['photo']);
unlink("files/photo/mini_".$user['photo']);
DB::$dbs->query("UPDATE ".USERS." SET `photo` = ? WHERE `user_id` = ?", array(NULL, $user['user_id']));
DB::$dbs->query("DELETE FROM ".PHOTO_RATING." WHERE `friend_id` = ? ", array($user['user_id']));
DB::$dbs->query("DELETE FROM ".PHOTO_COMM." WHERE `friend_id` = ? ", array($user['user_id']));
header("Location: ".HOME."/menu/photo");
}
echo DIV_AUT;
if (empty($user['photo'])) {
echo '<img src="'.HOME.'/style/img/noava.png" width="100px;"/><br />';
echo '<form action="?" enctype="multipart/form-data" method="POST">';
echo '<b>Avatar:</b> [max. 5mb; 1600x1600px; jpg, gif, png]<br /><input type="file" name="file"/><br />';
echo '<input type="submit" value="Yuklash"/>';
echo '</form>';
} else {
echo '<a href="'.HOME.'/files/photo/'.$user['photo'].'"><img src="'.HOME.'/files/photo/mini_'.$user['photo'].'"/></a><br />';
echo '<form action="?" method="POST"><input type="submit" name="delete" value="O`chirish"/></form>';
}
echo CLOSE_DIV;
echo '<div class="sts">Bu yerda siz sahifangizga rasm qo`yishingiz mumkun, fotoalbomingizda rasm bo`lmasa ham</div>';
$array = array('Kabinet', 'Avatar');
nav($array);
break;
case 'anceta':
head('Anketani tahrirlash');
if ($_POST) {
$surname = html($_POST['surname']);
$name = html($_POST['name']);
$gender = num($_POST['gender']);
$bday = abs(num($_POST['bday']));
$bmonth = abs(num($_POST['bmonth']));
$byear = abs(num($_POST['byear']));
$about = html($_POST['about']);
$interes = html($_POST['interes']);
$music = html($_POST['music']);
$cinema = html($_POST['cinema']);
$books = html($_POST['books']);
$smok = abs(num($_POST['smok']));
$alco = abs(num($_POST['alco']));
$narco = abs(num($_POST['narco']));
if (!empty($bday) && $bday > 31) {
$err .= 'Tug`ulgan kun xato ko`rsatilgan';
}
if (!empty($bmonth) && $bmonth > 12) {
$err .= 'Tug`ulgan oy xato ko`rsatilgan';
}
if (!empty($bday) || !empty($bmonth) || !empty($byear)) {
$age = calc_age($bday . '/' . $bmonth . '/' . $byear);
}
if ($smok > 6 || $alco > 5 || $narco > 6) {
$err .= 'Dam olish kunlari xato ko`rsatilgan<br />';
}
if (empty($surname) || empty($name)) {
$err .= 'Barcha maydonchalarni to`ldirib chiqing<br />';
}
if (strlen($surname) < 2) {
$err .= 'Familiya juda qisqa. [Min. 2 belgi]<br />';
}
if (strlen($name) < 2) {
$err .= 'Juda qisqa ism. [Min. 2 belgi]<br />';
}
if ($err) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".USERS." SET `surname` = ?, `name` = ?, `gender` = ?, `bday` = ?, `bmonth` = ?, `byear` = ?, `age` = ?,
`about` = ?, `interes` = ?, `music` = ?, `cinema` = ?, `books` = ?, `smok` = ?, `alco` = ?, `narco` = ? WHERE `user_id` = ?",array($surname, $name, $gender, $bday, $bmonth, $byear, $age, $about, $interes, $music, $cinema, $books, $smok, $alco, $narco, $user['user_id']));
echo DIV_MSG . 'Ma`lumotlar muvaffaqiyatli yangilandi' . CLOSE_DIV;
}
}
echo DIV_AUT;
echo '<form action="#" method="POST">';
echo '<b>Familiya:</b><br /><input type="text" name="surname" value="'.$user['surname'].'" /><br /><br />';
echo '<b>Ism:</b><br /><input type="text" name="name" value="'.$user['name'].'" /><br /><br />';
echo '<b>Jins:</b><br /><input type="radio" name="gender" value="0" '.($user['gender'] == 0 ? 'checked="checked"' : NULL).' /> Ayol<br /><input type="radio" name="gender" value="1" '.($user['gender'] == 1 ? 'checked="checked"' : NULL).' /> Erkak<br /><br />';
echo '<b>Tug`ulgan kun:</b><br /><select name="bday">';
for ($i == 1; $i < 32; ++$i) {
echo '<option value="'.$i.'" '.($i == $user['bday'] ? 'selected="selected"' : NULL).' ">'.($i == 0 ? '[Ko`rsatilmagan]' : $i).'</option>';
}
echo '</select>';
echo '<select name="bmonth">';
echo '<option value="0" '.(0 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo '<option value="1" '.(1 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Yanvar</option>';
echo '<option value="2" '.(2 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Fevral</option>';
echo '<option value="3" '.(3 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Mart</option>';
echo '<option value="4" '.(4 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Aprel</option>';
echo '<option value="5" '.(5 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">May</option>';
echo '<option value="6" '.(6 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Iyun</option>';
echo '<option value="7" '.(7 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Iyul</option>';
echo '<option value="8" '.(8 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Avgust</option>';
echo '<option value="9" '.(9 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Sentabr</option>';
echo '<option value="10" '.(10 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Oktyabr</option>';
echo '<option value="11" '.(11 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Noyabr</option>';
echo '<option value="12" '.(12 == $user['bmonth'] ? 'selected="selected"' : NULL).' ">Dekabr</option>';
echo '</select>';
echo '<select name="byear">';
echo '<option value="0" '.(0 == $user['byear'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
for ($i = 2002; $i >= 1950; --$i) {
echo '<option value="'.$i.'" '.($i == $user['byear'] ? 'selected="selected"' : NULL).' ">'.($i == 0 ? '[Ko`rsatilmagan]' : $i).'</option>';
}
echo '</select><br /><br />';
echo 'Shahar: <a href="'.HOME.'/menu/city" title="O`zgartirish">' . city($user['city']) . '</a><br /><br />';
echo '<b>O`zingiz haqida:</b><br /><textarea name="about">'.$user['about'].'</textarea><br />';
echo '<b>Qiziqishlaringiz:</b><br /><textarea name="interes">'.$user['interes'].'</textarea><br />';
echo '<b>Sevimli musiqangiz:</b><br /><textarea name="music">'.$user['music'].'</textarea><br />';
echo '<b>Sevimli filmlaringiz:</b><br /><textarea name="cinema">'.$user['cinema'].'</textarea><br />';
echo '<b>Sevimli kitoblaringiz:</b><br /><textarea name="books">'.$user['books'].'</textarea><br />';
echo '<b>Chekishga a`loqangiz:</b><br /><select name="smok">';
echo ' <option value="0" '.(0 == $user['smok'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo ' <option value="1" '.(1 == $user['smok'] ? 'selected="selected"' : NULL).' ">Chekmaganman</option>';
echo ' <option value="2" '.(2 == $user['smok'] ? 'selected="selected"' : NULL).' ">Tashaganman</option>';
echo ' <option value="3" '.(3 == $user['smok'] ? 'selected="selected"' : NULL).' ">Tashayapman</option>';
echo ' <option value="4" '.(4 == $user['smok'] ? 'selected="selected"' : NULL).' ">Faqat ichgan paytimda</option>';
echo ' <option value="5" '.(5 == $user['smok'] ? 'selected="selected"' : NULL).' ">Paravoz kabi tutataman ;)</option>';
echo ' <option value="6" '.(6 == $user['smok'] ? 'selected="selected"' : NULL).' ">Chekaman, lekin sigaretnimas</option>';
echo '</select><br />';
echo '<b>Ichishga a`loqangiz:</b><br /><select name="alco">';
echo ' <option value="0" '.(0 == $user['alco'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo ' <option value="1" '.(1 == $user['alco'] ? 'selected="selected"' : NULL).' ">Ichmaganman</option>';
echo ' <option value="2" '.(2 == $user['alco'] ? 'selected="selected"' : NULL).' ">Tashaganman</option>';
echo ' <option value="3" '.(3 == $user['alco'] ? 'selected="selected"' : NULL).' ">Faqat bayramlarda</option>';
echo ' <option value="4" '.(4 == $user['alco'] ? 'selected="selected"' : NULL).' ">Tez tashayman</option>';
echo ' <option value="5" '.(5 == $user['alco'] ? 'selected="selected"' : NULL).' ">Ichaman</option>';
echo '</select><br />';
echo '<b>Odamlarda asosiysi:</b><br /><select name="narco">';
echo ' <option value="0" '.(0 == $user['narco'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo ' <option value="1" '.(1 == $user['narco'] ? 'selected="selected"' : NULL).' ">Aql va ijod</option>';
echo ' <option value="2" '.(2 == $user['narco'] ? 'selected="selected"' : NULL).' ">Rahmdillik va rostgo`ylik</option>';
echo ' <option value="3" '.(3 == $user['narco'] ? 'selected="selected"' : NULL).' ">Boylik va kuchlilik</option>';
echo ' <option value="4" '.(4 == $user['narco'] ? 'selected="selected"' : NULL).' ">Jasurlik va qat`iyat</option>';
echo ' <option value="5" '.(5 == $user['narco'] ? 'selected="selected"' : NULL).' ">Hazilkashlik va hayotni sevish</option>';
echo ' <option value="6" '.(6 == $user['narco'] ? 'selected="selected"' : NULL).' ">Manga farqi yo`q ;)</option>';
echo '</select><br />';
echo '<input type="submit" value="Saqlash" /><br /><br />';
echo '- <a href="'.HOME.'/menu/love" title="O`zgartirish">Tanishuv anketasi</a><br />';
echo '</form>';
echo CLOSE_DIV;
$array = array('Kabinet', 'Anketani tahrirlash');
nav($array);
break;
case 'love':
head('Tanishuv anketasi');
if ($_POST) {
$poznakom = abs(num($_POST['poznakom']));
$age1 = abs(num($_POST['age1']));
$age2 = abs(num($_POST['age2']));
$goal = abs(num($_POST['goal']));
$family_status = abs(num($_POST['family_status']));
$children = abs(num($_POST['children']));
$orientation = abs(num($_POST['orientation']));
if ($poznakom > 2 || ($age1 > $age2) || $goal > 6 || $family_status > 6 || $children > 5 || $orientation > 3) {
$err .= 'Xatolik<br />';
}
if ($err) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".USERS." SET `poznakom` = ?, `age1` = ?, `age2` = ?, `goal` = ?, `family_status` = ?, `children` = ?, `orientation` = ? WHERE `user_id` = ?",
array($poznakom, $age1, $age2, $goal, $family_status, $children, $orientation, $user['user_id']));
echo DIV_MSG . 'Ma`lumotlar muvaffaqiyatli yangilandi' . CLOSE_DIV;
}
}
echo DIV_AUT;
echo '<form action="#" method="POST">';
echo '<b>Tanishaman:</b><br /><select name="poznakom">';
echo '<option value="0" '.(0 == $user['poznakom'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo '<option value="1" '.(1 == $user['poznakom'] ? 'selected="selected"' : NULL).' ">Qiz bola bilan</option>';
echo '<option value="2" '.(2 == $user['poznakom'] ? 'selected="selected"' : NULL).' ">O`g`il bola bilan</option>';
echo '</select><br />';
echo '<b>Yoshi:</b><br /> <input type="text" name="age1" value="'.$user['age1'].'" size="2"/> dan <input type="text" name="age2" value="'.$user['age2'].'" size="2"/> gacha<br />';
echo '<b>Tanishishdan maqsadi:</b><br /><select name="goal">';
echo '<option value="0" '.(0 == $user['goal'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo '<option value="1" '.(1 == $user['goal'] ? 'selected="selected"' : NULL).' ">Do`stlik</option>';
echo '<option value="2" '.(2 == $user['goal'] ? 'selected="selected"' : NULL).' ">Suhbat</option>';
echo '<option value="3" '.(3 == $user['goal'] ? 'selected="selected"' : NULL).' ">Flirt</option>';
echo '<option value="4" '.(4 == $user['goal'] ? 'selected="selected"' : NULL).' ">Sevgi</option>';
echo '<option value="5" '.(5 == $user['goal'] ? 'selected="selected"' : NULL).' ">Uchrashuv uchun</option>';
echo '<option value="6" '.(6 == $user['goal'] ? 'selected="selected"' : NULL).' ">Jiddiy a`loqa uchun</option>';
echo '</select><br />';
echo '<b>Oilaviy ahvoli:</b><br /><select name="family_status">';
echo '<option value="0" '.(0 == $user['family_status'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo '<option value="1" '.(1 == $user['family_status'] ? 'selected="selected"' : NULL).' ">'.($user['gender'] == 0 ? 'Bo`shman' : 'Bo`shman').'</option>';
echo '<option value="2" '.(2 == $user['family_status'] ? 'selected="selected"' : NULL).' ">'.($user['gender'] == 0 ? 'Turmushga chiqganman' : 'Uylanganman').'</option>';
echo '<option value="3" '.(3 == $user['family_status'] ? 'selected="selected"' : NULL).' ">'.($user['gender'] == 0 ? 'Bandman' : 'Bandman').'</option>';
echo '<option value="4" '.(4 == $user['family_status'] ? 'selected="selected"' : NULL).' ">Ikkinchi juftimni izlashdaman</option>';
echo '<option value="5" '.(5 == $user['family_status'] ? 'selected="selected"' : NULL).' ">Sevganim yo`q</option>';
echo '<option value="6" '.(6 == $user['family_status'] ? 'selected="selected"' : NULL).' ">Hammavaqt tayyorman</option>';
echo '</select><br />';
echo '<b>Bolalaringiz bormi?:</b><br /><select name="children">';
echo '<option value="0" '.(0 == $user['children'] ? 'selected="selected"' : NULL).' ">[Ko`rsatilmagan]</option>';
echo '<option value="1" '.(1 == $user['children'] ? 'selected="selected"' : NULL).' ">Hali yo`q</option>';
echo '<option value="2" '.(2 == $user['children'] ? 'selected="selected"' : NULL).' ">Yo`q</option>';
echo '<option value="3" '.(3 == $user['children'] ? 'selected="selected"' : NULL).' ">Bor</option>';
echo '<option value="4" '.(4 == $user['children'] ? 'selected="selected"' : NULL).' ">Yo`q, ammo istayman</option>';
echo '<option value="5" '.(5 == $user['children'] ? 'selected="selected"' : NULL).' ">Ulg`ayishgan</option>';
echo '</select><br />';
echo '<input type="submit" value="Saqlash" /><br />';
echo '</form>';
echo CLOSE_DIV;
$array = array('Kabinet', 'Anketani tahrirlash', 'Tanishuv anketasi');
nav($array);
break;
case 'sett':
head('Sozlamalar');
if ($_POST['mail']) {
$email = html($_POST['email']);
if (empty($email)) {
$err .= 'E-Mailni to`ldiring<br />';
}
if (strlen($email) < 8) {
$err .= 'E-Mail juda qisqa. [Min. 8 belgi]<br />';
}
if(!preg_match("|^[-0-9a-z_.]+@[-0-9a-z_^.]+.[a-z]{2,6}$|i", $email)) {
$err .= 'E-Mailni to`g`ri formatda ko`rsating<br />';
}
if ($err) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".USERS." SET `email` = ? WHERE `user_id` = ?",array($email, $user['user_id']));
echo DIV_MSG . 'E-Mail muvaffaqiyatli o`zgartirildi' . CLOSE_DIV;
}
}
if ($_POST['pass']) {
$password = html($_POST['password']);
$password2 = html($_POST['password2']);
if (empty($password) || empty($password2)) {
$err .= 'Barcha maydonchalarni to`ldiring<br />';
}
if (strlen($password) < 6) {
$err .= 'Juda qisqa parol. [Min. 6 belgi]<br />';
}
if ($password != $password2) {
$err .= 'Parollar to`g`ri kelmayapti.<br />';
}
if ($err) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".USERS." SET `password` = ? WHERE `user_id` = ?",array(md5($password), $user['user_id']));
echo DIV_MSG . 'Parol muvaffaqiyatli o`zgartirildi' . CLOSE_DIV;
}
}
if (isset($_POST['wapver'])) {
DB::$dbs->query("UPDATE ".USERS." SET `site_version` = ? WHERE `user_id` = ?",array(html($_POST[wapver]), $user['user_id']));
header("Location: " . HOME . "/menu/sett");
}
if (isset($_POST['webver'])) {
DB::$dbs->query("UPDATE ".USERS." SET `web_version` = ? WHERE `user_id` = ?",array(html($_POST[webver]), $user['user_id']));
header("Location: " . HOME . "/menu/sett");
}
echo DIV_AUT;
echo '<b>E-Mail Sozlamalari:</b><br /><br />';
echo '<form action="#" method="POST">';
echo 'Yangi E-Mail:<br /><input type="text" name="email" /><br /><br />';
echo '<input type="submit" name="mail" value="Saqlash" /></form>';
echo CLOSE_DIV;
echo DIV_AUT;
echo '<b>Parolni o`zgartirish:</b><br /><br />';
echo '<form action="#" method="POST">';
echo 'Yangi parol:<br /><input type="password" name="password" /><br /><br />';
echo 'Takrorlang:<br /><input type="password" name="password2" /><br /><br />';
echo '<input type="submit" name="pass" value="Saqlash" /></form>';
echo CLOSE_DIV;
$array = array('Kabinet', 'Sozlamalar');
nav($array);
break;
case 'city':
head('Shaharni izlash');
if ($_GET['save']) {
$id = abs(intval($_GET['save']));
if (DB::$dbs->querySingle("SELECT COUNT(`city_id`) FROM ".CITY." WHERE `city_id` = ?", array($id)) == FALSE) {
echo DIV_ERROR . 'Shahar topilmadi' . CLOSE_DIV;
} else {
DB::$dbs->query("UPDATE ".USERS." SET `city` = ? WHERE `user_id` = ?",array($id, $user['user_id']));
echo DIV_MSG . 'Shahar muvaffaqiyatli yangilandi' . CLOSE_DIV;
}
}
if ($_POST) {
$search = html($_POST['city']);
$all = DB::$dbs->querySingle("SELECT COUNT(`country_id`) FROM ".CITY." WHERE `name` LIKE '%".$search."%'");
if ($all) {
echo DIV_LI;
echo 'Natijalar <b>' . $all . '</b>: [Shahar tanlang]<br />';
$sql = DB::$dbs->query("SELECT * FROM ".CITY." WHERE `name` LIKE '%".$search."%'");
while($city = $sql -> fetch()) {
$country = DB::$dbs->queryFetch("SELECT `name` FROM ".COUNTRY." WHERE `country_id` = ? LIMIT 1",array($city['country_id']));
$region = DB::$dbs->queryFetch("SELECT `name` FROM ".REGION." WHERE `region_id` = ? LIMIT 1",array($city['region_id']));
echo ' - <a href="'.HOME.'/menu/city?save='.$city['city_id'].'">'.$city['name'].' ('.$region['name'].', '.$country['name'].')</a><br />';
}
echo CLOSE_DIV;
}
}
echo DIV_AUT;
echo '<form action="#" method="POST">';
echo 'Shahar: [Кирилчада йозинг]<br /><input type="text" name="city" value="" /><br /><br />';
echo '<input type="submit" value="Izlash" /><br />';
echo '</form>';
echo CLOSE_DIV;
$array = array('Kabinet', 'Shaharni izlash');
nav($array);
break;
}
require_once('core/stop.php');
?>