<?
       $session = get_session_details();
            $loggeduser = (object)$session->userdetails;
            $userid = $loggeduser->userid;

$foydalanuvchi_query = mysql_query("SELECT * FROM `users` WHERE `user_id` = '{$userid}'");
$user = mysql_fetch_assoc($foydalanuvchi_query);

if (isset($_POST['saqlash'])) {
    $xatolik = array();
    $t_kun = isset($_POST['t_kun']) ? $_POST['t_kun'] : false;
    $t_oy = isset($_POST['t_oy']) ? $_POST['t_oy'] : false;
    $t_yil = isset($_POST['t_yil']) ? $_POST['t_yil'] : false;
    $joylashuv = isset($_POST['joylashuv']) ? $_POST['joylashuv'] : false;
    $telefon = isset($_POST['telefon']) ? mb_substr($_POST['telefon'], 0, 40) : '';
    if (!$xatolik) {
        $rid = 0;
        mysql_query("UPDATE `users` SET
            `t_kun` = '$t_kun',
            `t_oy` = '$t_oy',
            `t_yil` = '$t_yil',
            `joylashuv` = '$joylashuv',
            `telefon` = '$telefon'
             WHERE `user_id` = '" . $user['user_id'] . "'
        ");
        echo '<div class="gmenu">Profil ma\'lumotlari yanilandi<br /><a class="blue" href="yangiliklar.php">Profilni ko\'rish</a></div>';
    } else {
        echo '<a href="yangiliklar.php">Xatolik yuz berdi. Orqaga</a>';
    }
} else {

?>




<form action="shaxsiy.php" method="post">
    <fieldset class="b-form_fieldset ng-scope">
        <div class="b-form_fieldset_title ng-binding">
            Shaxsiy ma'lumotlar
        </div>
        
        <div class="b-form_fieldset_desc ng-binding ng-hide">
        </div>
        
        <div class="b-form_fieldset_error ng-binding ng-hide">
        </div>
        
        <div ng-switch="block.isCustomLogin">
        </div>
        <div class="ng-scope">
            <div class="b-field ng-scope">
                <div class="b-field__name ng-binding">
                    Telefon raqamingiz
                </div>
                <div class="b-field__input ng-scope">
                    <input type="text" class="b-field__type ng-pristine ng-valid ng-scope ng-touched" name="telefon" value="<?echo $user['telefon'];?>">
                </div>
            </div>
        </div>
        <div class="ng-scope">
            <div class="b-field ng-scope">
                <div class="b-field__name ng-binding">
                    Tug'ilgan kuningiz
                </div>
                <div class="b-field__input ng-scope b-field_input__multi-select">
                    <div class="b-field__inner ng-scope ng-isolate-scope">
                        <?
                        echo '
                        <select class="b-field__type month ng-pristine ng-untouched ng-valid"  name="t_kun">';
                            for ($i = 1; $i < 32; $i++) {
                                echo '<option value="'.$i.'" ' . ($user['t_kun'] == $i ? ' selected="selected"' : '') . '>'.$i.'</option>'."\n";
                            } echo '
                        </select>';
                        ?> 
                        <select class="b-field__type month ng-pristine ng-untouched ng-valid" name="t_oy">
                            <option <?echo '' .($user['t_oy'] == '1' ? ' selected="selected"' : '')?> value="1" label="Yanvar">
                                Yanvar
                            </option>
                            <option <?echo '' .($user['t_oy'] == '2' ? ' selected="selected"' : '')?> value="2" label="Fevral">
                                Fevral
                            </option>
                            <option <?echo '' .($user['t_oy'] == '3' ? ' selected="selected"' : '')?> value="3" label="Mart">
                                Mart
                            </option>
                            <option <?echo '' .($user['t_oy'] == '4' ? ' selected="selected"' : '')?> value="4" label="апреля">
                                Aprel
                            </option>
                            <option <?echo '' .($user['t_oy'] == '5' ? ' selected="selected"' : '')?> value="5" label="May">
                                May
                            </option>
                            <option <?echo '' .($user['t_oy'] == '6' ? ' selected="selected"' : '')?> value="6" label="Iyun">
                                Iyun
                            </option>
                            <option <?echo '' .($user['t_oy'] == '7' ? ' selected="selected"' : '')?> value="7" label="Iyul">
                                Iyul
                            </option>
                            <option <?echo '' .($user['t_oy'] == '8' ? ' selected="selected"' : '')?> value="8" label="Avgus">
                                Avgust
                            </option>
                            <option <?echo '' .($user['t_oy'] == '9' ? ' selected="selected"' : '')?> value="9" label="Sentyabr">
                                Sentyabr
                            </option>
                            <option <?echo '' .($user['t_oy'] == '10' ? ' selected="selected"' : '')?> value="10" label="Oktyabr">
                                Oktyabr
                            </option>
                            <option <?echo '' .($user['t_oy'] == '11' ? ' selected="selected"' : '')?> value="11" label="Noyabr">
                                Noyabr
                            </option>
                            <option <?echo '' .($user['t_oy'] == '12' ? ' selected="selected"' : '')?> value="12" label="Dekabr">
                                Dekabr
                            </option>
                        </select>
                        <?
                        echo '
                        <select class="b-field__type month ng-pristine ng-untouched ng-valid" name="t_yil">';
                            for ($i = 1935; $i < 2010; $i++) {
                                echo '<option name="monthb" value="'.$i.'" ' . ($user['t_yil'] == $i ? ' selected="selected"' : '') . '>'.$i.'</option>'."\n";
                            } echo '
                        </select>';
                        ?>
                    </div>
                </div>
            </div>
        </div>
        <div class="ng-scope">
            <div class="b-field ng-scope">
                <div class="b-field__name ng-binding">
                    Joylashuv
                </div>
                <div class="b-field__input ng-scope" >
                    <select name="joylashuv" class="b-field__type ng-pristine ng-untouched ng-valid ng-scope">
                        <option <?echo ($user['joylashuv'] == 'Andijon' ? ' selected="selected"' : '');?> value="Andijon">Andijon</option>
                        <option <?echo ($user['joylashuv'] == 'Buxoro' ? ' selected="selected"' : '');?> value="Buxoro">Buxoro</option>
                        <option <?echo ($user['joylashuv'] == 'Jizzax' ? ' selected="selected"' : '');?> value="Jizzax">Jizzax</option>
                        <option <?echo ($user['joylashuv'] == 'Namangan' ? ' selected="selected"' : '');?> value="Namangan">Namangan</option>
                        <option <?echo ($user['joylashuv'] == 'Qoraqolpog\'iston respublikas' ? ' selected="selected"' : '');?> value="Qoraqolpog\'iston Respublikasi">Qoraqolpog\'iston respublikasi</option>
                        <option <?echo ($user['joylashuv'] == 'Qashqadaryo viloyati' ? ' selected="selected"' : '');?> value="Qashqadaryo viloyati">Qashqadaryo viloyati</option>
                        <option <?echo ($user['joylashuv'] == 'Samarqand' ? ' selected="selected"' : '');?> value="Samarqand">Samarqand</option>
                        <option <?echo ($user['joylashuv'] == 'Surxandaryo viloyati' ? ' selected="selected"' : '');?> value="Surxandaryo viloyati">Surxandaryo viloyati</option>
                        <option <?echo ($user['joylashuv'] == 'Toshkent shaxri' ? ' selected="selected"' : '');?> value="Toshkent shaxri">Toshkent shaxri</option>
                        <option <?echo ($user['joylashuv'] == 'Toshkent viloyati' ? ' selected="selected"' : '');?> value="Toshkent viloyati">Toshkent viloyati</option>
                        <option <?echo ($user['joylashuv'] == 'Xorazm' ? ' selected="selected"' : '');?> value="Xorazm">Xorazm</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="b-button__inline">
            <input type="submit" name="saqlash" value="Saqlash" class="b-button">
            <input type="button" value="Bekor qilish" class="b-button b-button__white" ng-click="cancel()">
        </div>
    </fieldset>
</form>


<?}?>


