예제 #1
0
 * Date: 9/7/15
 * Time: 5:20 PM
 */
require_once "../core/core.php";
if (isset($_GET["title"])) {
    $blog = DatabaseHandler::GetRow("SELECT * FROM `blogs` WHERE `title_en` = '{$_GET['title']}' ; ");
    if (!isset($blog["id"])) {
        die("پست مورد نظر وجود ندارد.");
    }
    $page_title = "Talentyab | {$blog['title_en']}";
    $keywords = "";
    $keywords_array = DatabaseHandler::GetAll("SELECT * FROM `blog_keywords` WHERE `blog_id` = '{$blog['id']}' ; ");
    foreach ($keywords_array as $keyword) {
        $keywords .= $keyword["keyword"] . " , ";
    }
    $author = ADMINS::admins_SelectRow($blog["admin_id"]);
    $author_name = $author["first_name"] . " " . $author["last_name"];
    $comments = DatabaseHandler::GetAll("SELECT * FROM `comments` WHERE `activate` = '1' AND `blog_id` = '{$blog['id']}' AND `comment_id` = '0' ;  ");
    $comments_echo = '';
    foreach ($comments as $comment) {
        $avatar = "";
        if ($comment["admin_id"] == "1") {
            $avatar = '<a class="profile-pic" href="#"><img src="../view/images/logo_thumb.png"></a>';
        } else {
            $avatar = '<a class="profile-pic avatar-letter" style="background-color:' . G::randomColor($comment["id"]) . '; " href="#">' . G::convertToAvatar($comment["full_name"]) . '</a>';
        }
        $comments_echo .= '
                    <div class="comment">
                        <div class="pull-left reply-btn" data-id="' . $comment["id"] . '"><a href="#">پاسخ</a></div>
                        ' . $avatar . '
                        <a class="user-name" href="#">' . $comment["full_name"] . '</a>
<h3 class="sub-header">تغییر رمز عبور</h3>
<?php 
$error = '';
error_reporting(E_ALL);
ini_set('display_errors', '1');
date_default_timezone_set('Asia/Tehran');
if (isset($_POST['submit'])) {
    if (isset($_POST['old_password']) && $_POST['password'] != '' && $_POST['repassword'] != '') {
        $id = $_SESSION['MM_admin_id'];
        $old_password_row = ADMINS::admins_SelectRow($id);
        $old_password = $_POST['old_password'];
        $old_password_hash = sha1($old_password);
        $password = $_POST['password'];
        $password_hash = sha1($password);
        $repassword = $_POST['repassword'];
        if ($old_password_hash == $old_password_row['password']) {
            if ($password == $repassword) {
                $change_password_result = DatabaseHandler::Execute("UPDATE admins SET password='******' WHERE id='{$id}';");
                if ($change_password_result) {
                    $error = ADMIN_CHANGE_PASSWORD_SUCCESS;
                } else {
                    $error = ADMIN_CHANGE_PASSWORD_FAILED;
                }
            } else {
                $error = ADMIN_CHANGE_PASSWORD_MATCH;
            }
        } else {
            $error = ADMIN_CHANGE_PASSWORD_CURRENT;
        }
    } else {
        $error = ADMIN_CHANGE_PASSWORD_FIELDS;
예제 #3
0
<h3 class="sub-header">
ویرایش
</h3>

<?php 
$error = '';
$id = $_SESSION['MM_admin_id'];
if (isset($_POST['submit'])) {
    $error = DatabaseHandler::Execute("UPDATE `admins` SET `first_name`='{$_POST['first_name']}',`last_name`='{$_POST['last_name']}',`mobile`='{$_POST['mobile']}',`about`='{$_POST['about']}' WHERE `id` = '{$id}' ; ");
    if ($error) {
        $error = ADMIN_EDIT_SUCCESS;
    } else {
        $error = ADMIN_EDIT_FAILED;
    }
}
$user = ADMINS::admins_SelectRow($id);
?>
<div class="col-xs-3 col-xs-offset-9">
    <form method="post" role="form" class="form">
        <label for="old_password">نام :</label><input type="text" value="<?php 
echo $user["first_name"];
?>
" name="first_name" class="form-control" >
        <label for="password">نام خانوادگی :</label><input type="text" value="<?php 
echo $user["last_name"];
?>
" name="last_name" class="form-control"  >
        <label for="repassword">شماره موبایل :</label><input type="text" value="<?php 
echo $user["mobile"];
?>
" class="form-control" name="mobile" >