function account_class($site)
    {
        $this->site = $site;
        $this->engine = $this->site->engine;
        if (!empty($site->get[3])) {
            $site->content = engine::error();
            return;
        }
        if (!empty($_SESSION["user"]["id"])) {
            if (!empty($site->get[1])) {
                if ($site->get[1] == "settings") {
                    if (!empty($_POST["name"])) {
                        $name = mysql_real_escape_string($_POST["name"]);
                        $email = strtolower(mysql_real_escape_string($_POST["email"]));
                        $query = 'UPDATE `nodes_users` SET `name` = "' . $name . '", `email` = "' . $email . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                        engine::mysql($query);
                        $_SESSION["user"]["name"] = $name;
                        $_SESSION["user"]["email"] = $email;
                        if (!empty($_FILES["img"]["tmp_name"])) {
                            $file = engine::upload_photo("img", "img/pic", 50, 50);
                            if ($file != "error") {
                                $file = "/img/pic/" . $file;
                                $query = 'UPDATE `nodes_users` SET `photo` = "' . $file . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                                engine::mysql($query);
                                $_SESSION["user"]["photo"] = $file;
                            }
                        }
                    }
                    if (!empty($_POST["pass"])) {
                        $password = md5(trim($_POST["pass"]));
                        $query = 'UPDATE `nodes_users` SET `pass` = "' . $password . '" WHERE `id` = "' . $_SESSION["user"]["id"] . '"';
                        engine::mysql($query);
                    }
                    $site->title = $GLOBALS["Lang"]["Settings"] . ' - ' . $site->title;
                    $site->content = '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["Settings"] . '</h1>';
                    if (empty($_SESSION["user"]["email"])) {
                        $site->content .= '<p>' . $GLOBALS["Lang"]["Enter your email and password to continue"] . '</p>';
                    }
                    $site->content .= '<br/><form method="POST" enctype="multipart/form-data">
                        <div style="width: 300px; margin:auto; text-align:center;">
                        <table>
                        <tr>
                            <td style="padding-bottom: 10px; width: 70px;padding-right: 5px;" align=right><img src="' . $_SESSION["user"]["photo"] . '" width=50  style="border: #d0d0d0 4px solid; border-radius: 4px;  margin-top: -5px;" /></td>
                            <td style="padding-bottom: 0px;" valign=top><div style="float:left; text-align:left; padding-left: 5px;">' . $GLOBALS["Lang"]["Change picture"] . ':<br/><input type="file" name="img" class="input" style="width: 200px;margin-top: 5px;" /></div></td>
                        </tr>
                        
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Name"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="text" name="name" value="' . $_SESSION["user"]["name"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    if (!empty($_SESSION["user"]["email"])) {
                        $site->content .= '
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Email"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="text" name="email" value="' . $_SESSION["user"]["email"] . '" class="input" style="width: 200px;" /></td>
                        </tr>
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Password"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input type="password" name="pass" value="" placeHolder="' . $GLOBALS["Lang"]["New password"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    } else {
                        $site->content .= '
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Email"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input required type="text" name="email" placeHolder="' . $GLOBALS["Lang"]["Enter your email"] . '" class="input" style="width: 200px;" /></td>
                        </tr>
                        <tr>
                            <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Password"] . ':</td>
                            <td style="padding-bottom: 10px;" ><input required type="password" name="pass" value="" placeHolder="' . $GLOBALS["Lang"]["Enter your password"] . '" class="input" style="width: 200px;" /></td>
                        </tr>';
                    }
                    $site->content .= '
<tr>
';
                    if (empty($_SESSION["user"]["url"])) {
                        $site->content .= '<td colspan=2 style="padding: 5px;">';
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "vk_id"';
                        $res = engine::mysql($query);
                        $vk = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "fb_id"';
                        $res = engine::mysql($query);
                        $fb_id = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "tw_key"';
                        $res = engine::mysql($query);
                        $tw_key = mysql_fetch_array($res);
                        $query = 'SELECT * FROM `nodes_config` WHERE `name` = "gp_id"';
                        $res = engine::mysql($query);
                        $gp_id = mysql_fetch_array($res);
                        if (!empty($fb_id["value"]) || !empty($tw_key["value"]) || !empty($gp_id["value"]) || !empty($vk["value"])) {
                            $site->content .= '<div style="padding: 5px; border: #eee 1px solid; border-radius: 5px;">Connect with social network<br/><br/>';
                            if (!empty($fb_id["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href=\'https://www.facebook.com/dialog/oauth?client_id=' . $fb_id["value"] . '&redirect_uri=' . urlencode("http://" . $_SERVER["HTTP_HOST"] . "/account.php?mode=social&method=fb") . '\' style="margin: 15px; margin-left: 0px; cursor: pointer;"><img src="/img/social/fb.png" title="Facebook"/></a>';
                            }
                            if (!empty($tw_key["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="http://' . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=tw" style="margin: 15px;"><img src="/img/social/tw.png" title="Twitter"/></a>';
                            }
                            if (!empty($gp_id["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="http://' . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=gp" style="margin: 15px;"><img src="/img/social/gp.png" title="Google+"/></a>';
                            }
                            if (!empty($vk["value"])) {
                                $site->content .= '<a rel="nofollow" target="_blank" href="https://oauth.vk.com/authorize?client_id=' . $vk["value"] . '&scope=notify&redirect_uri=' . urlencode("http://" . $_SERVER["HTTP_HOST"] . '/account.php?mode=social&method=vk') . '&display=page&response_type=token" style="margin: 15px; margin-right: 0px;"><img src="/img/social/vk.png" title="VK"/></a>';
                            }
                            $site->content .= '</div>';
                        }
                    } else {
                        $site->content .= ' <td align=right style="padding-bottom: 10px; width: 70px; padding-right: 5px;">' . $GLOBALS["Lang"]["Site"] . ':</td>
                            <td align=left style="padding-left: 7px;"><div style="overflow:hidden; height: 14px; width: 200px;"><a href="' . $_SESSION["user"]["url"] . '" target="_blank">' . str_replace('/', ' / ', str_replace("http://", '', $_SESSION["user"]["url"])) . '</a></div><br/>';
                    }
                    $site->content .= '<br/>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-top: 20px;" colspan=2>
                                <input type="submit" class="btn" style="width: 280px;" value="' . $GLOBALS["Lang"]["Save changes"] . '" /><br/><br/>
                                <a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a><br/><br/>
                            </td>
                        </tr>
                        </table>
                        </div>
                        </form>';
                } else {
                    if ($site->get[1] == "inbox") {
                        if (!empty($site->get[3])) {
                            $site->content = engine::error();
                            return;
                        }
                        $site->title = $GLOBALS["Lang"]["Messages"] . ' - ' . $site->title;
                        $site->content .= '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["Messages"] . '</h1><br/>';
                        if (empty($site->get[2])) {
                            $site->content .= '<center><iframe id="message_frame" src="/messages.php?id=' . $_SESSION["user"]["id"] . '" width=100% height=390 style="max-width: 700px;" ></iframe></center>' . '<a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a>';
                        } else {
                            $site->content .= '<center><iframe id="message_frame" src="/messages.php?mode=dialog&id=' . $_SESSION["user"]["id"] . '&target=' . $site->get[2] . '" width=100% height=390 style="max-width: 700px;" ></iframe></center>' . '<a href="/account"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Back to account"] . '"  /></a>';
                        }
                    } else {
                        $site->content = engine::error();
                        return;
                    }
                }
            } else {
                $site->title = $GLOBALS["Lang"]["My Account"] . ' - ' . $site->title;
                $site->content = '<h1 style="padding: 5px;">' . $GLOBALS["Lang"]["My Account"] . '</h1><br/><br/>';
                if ($_SESSION["user"]["id"] == "1") {
                    $site->content .= '<a href="/admin"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Admin"] . '" /></a><br/><br/>';
                }
                $site->content .= '<a href="/account/inbox"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Messages"] . '" /></a><br/><br/>' . '<a href="/account/settings"><input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Settings"] . '" /></a><br/><br/>' . '<input type="button" class="btn btnSmall" style="width: 280px;" value="' . $GLOBALS["Lang"]["Logout"] . '" onClick="logout();"  /><br/><br/>';
            }
        } else {
            $site->title = $GLOBALS["Lang"]["Access denied"] . ' - ' . $site->title;
            $site->content = '<h3 style="padding-top: 100px;">' . $GLOBALS["Lang"]["Access denied"] . '</h3><br/>';
        }
    }