Вход Регистрация
Файл: upload/admin/settings.php
Строк: 382
<?php require_once('header.php'); ?>

<?php
if(isset($_POST['form1'])) {
    
$valid 1;

    
$path $_FILES['photo_logo']['name'];
    
$path_tmp $_FILES['photo_logo']['tmp_name'];

    if(
$path == '') {
        
$valid 0;
        
$error_message .= 'You must have to select a photo<br>';
    } else {
        
$ext pathinfo$pathPATHINFO_EXTENSION );
        
$file_name basename$path'.' $ext );
        if( 
$ext!='jpg' && $ext!='png' && $ext!='jpeg' && $ext!='gif' ) {
            
$valid 0;
            
$error_message .= 'You must have to upload jpg, jpeg, gif or png file<br>';
        }
    }

    if(
$valid == 1) {
        
// removing the existing photo
        
$statement $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
        
$statement->execute();
        
$result $statement->fetchAll(PDO::FETCH_ASSOC);                            
        foreach (
$result as $row) {
            
$logo $row['logo'];
            
unlink('../assets/uploads/'.$logo);
        }

        
// updating the data
        
$final_name 'logo'.'.'.$ext;
        
move_uploaded_file$path_tmp'../assets/uploads/'.$final_name );

        
// updating the database
        
$statement $pdo->prepare("UPDATE tbl_settings SET logo=? WHERE id=1");
        
$statement->execute(array($final_name));

        
$success_message 'Logo is updated successfully.';
        
    }
}

if(isset(
$_POST['form2'])) {
    
$valid 1;

    
$path $_FILES['photo_favicon']['name'];
    
$path_tmp $_FILES['photo_favicon']['tmp_name'];

    if(
$path == '') {
        
$valid 0;
        
$error_message .= 'You must have to select a photo<br>';
    } else {
        
$ext pathinfo$pathPATHINFO_EXTENSION );
        
$file_name basename$path'.' $ext );
        if( 
$ext!='jpg' && $ext!='png' && $ext!='jpeg' && $ext!='gif' ) {
            
$valid 0;
            
$error_message .= 'You must have to upload jpg, jpeg, gif or png file<br>';
        }
    }

    if(
$valid == 1) {
        
// removing the existing photo
        
$statement $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
        
$statement->execute();
        
$result $statement->fetchAll(PDO::FETCH_ASSOC);                            
        foreach (
$result as $row) {
            
$favicon $row['favicon'];
            
unlink('../assets/uploads/'.$favicon);
        }

        
// updating the data
        
$final_name 'favicon'.'.'.$ext;
        
move_uploaded_file$path_tmp'../assets/uploads/'.$final_name );

        
// updating the database
        
$statement $pdo->prepare("UPDATE tbl_settings SET favicon=? WHERE id=1");
        
$statement->execute(array($final_name));

        
$success_message 'Favicon is updated successfully.';
        
    }
}

if(isset(
$_POST['form3'])) {
    
    
// updating the database
    
$statement $pdo->prepare("UPDATE tbl_settings SET footer_about=?, footer_copyright=?, contact_address=?, contact_email=?, contact_phone=?, contact_fax=?, contact_map_iframe=? WHERE id=1");
    
$statement->execute(array($_POST['footer_about'],$_POST['footer_copyright'],$_POST['contact_address'],$_POST['contact_email'],$_POST['contact_phone'],$_POST['contact_fax'],$_POST['contact_map_iframe']));

    
$success_message 'General content settings is updated successfully.';
    
}

if(isset(
$_POST['form4'])) {
    
// updating the database
    
$statement $pdo->prepare("UPDATE tbl_settings SET receive_email=?, receive_email_subject=?,receive_email_thank_you_message=? WHERE id=1");
    
$statement->execute(array($_POST['receive_email'],$_POST['receive_email_subject'],$_POST['receive_email_thank_you_message']));

    
$success_message 'Contact form settings information is updated successfully.';
}


if(isset(
$_POST['form5'])) {
    
// updating the database
    
$statement $pdo->prepare("UPDATE tbl_settings SET total_recent_news=?, total_popular_news=? WHERE id=1");
    
$statement->execute(array($_POST['total_recent_news'],$_POST['total_popular_news']));

    
$success_message 'Sidebar settings is updated successfully.';
}

if(isset(
$_POST['form6'])) {
    
// updating the database
    
$statement $pdo->prepare("UPDATE tbl_settings SET meta_title_home=?, meta_keyword_home=?, meta_description_home=? WHERE id=1");
    
$statement->execute(array($_POST['meta_title_home'],$_POST['meta_keyword_home'],$_POST['meta_description_home']));

    
$success_message 'Home Meta settings is updated successfully.';
}

if(isset(
$_POST['form7'])) {
    
// updating the database
    
$statement $pdo->prepare("UPDATE tbl_settings SET mod_rewrite=? WHERE id=1");
    
$statement->execute(array($_POST['mod_rewrite']));

    
$success_message 'Mod Rewrite settings is updated successfully.';
}
?>

<section class="content-header">
    <div class="content-header-left">
        <h1>Settings</h1>
    </div>
</section>

<?php
$statement 
$pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result $statement->fetchAll(PDO::FETCH_ASSOC);                            
foreach (
$result as $row) {
    
$logo                            $row['logo'];
    
$favicon                         $row['favicon'];
    
$footer_about                    $row['footer_about'];
    
$footer_copyright                $row['footer_copyright'];
    
$contact_address                 $row['contact_address'];
    
$contact_email                   $row['contact_email'];
    
$contact_phone                   $row['contact_phone'];
    
$contact_fax                     $row['contact_fax'];
    
$contact_map_iframe              $row['contact_map_iframe'];
    
$receive_email                   $row['receive_email'];
    
$receive_email_subject           $row['receive_email_subject'];
    
$receive_email_thank_you_message $row['receive_email_thank_you_message'];
    
$total_recent_news               $row['total_recent_news'];
    
$total_popular_news              $row['total_popular_news'];
    
$meta_title_home                 $row['meta_title_home'];
    
$meta_keyword_home               $row['meta_keyword_home'];
    
$meta_description_home           $row['meta_description_home'];
    
$mod_rewrite                     $row['mod_rewrite'];
}
?>


<section class="content" style="min-height:auto;margin-bottom: -30px;">
    <div class="row">
        <div class="col-md-12">
            <?php if($error_message): ?>
            <div class="callout callout-danger">
            <h4>Please correct the following errors:</h4>
            <p>
            <?php echo $error_message?>
            </p>
            </div>
            <?php endif; ?>

            <?php if($success_message): ?>
            <div class="callout callout-success">
            <h4>Success:</h4>
            <p><?php echo $success_message?></p>
            </div>
            <?php endif; ?>
        </div>
    </div>
</section>

<section class="content">

    <div class="row">
        <div class="col-md-12">
                            
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab">Logo</a></li>
                        <li><a href="#tab_2" data-toggle="tab">Favicon</a></li>
                        <li><a href="#tab_3" data-toggle="tab">General Content</a></li>
                        <li><a href="#tab_4" data-toggle="tab">Email Settings</a></li>
                        <li><a href="#tab_5" data-toggle="tab">Sidebar</a></li>
                        <li><a href="#tab_6" data-toggle="tab">Home Page Meta</a></li>
                        <li><a href="#tab_7" data-toggle="tab">Mod Rewrite</a></li>
                    </ul>
                    <div class="tab-content">
                          <div class="tab-pane active" id="tab_1">


                              <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
                              <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Existing Photo</label>
                                        <div class="col-sm-6" style="padding-top:6px;">
                                            <img src="../assets/uploads/<?php echo $logo?>" class="existing-photo" style="height:80px;">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">New Photo</label>
                                        <div class="col-sm-6" style="padding-top:6px;">
                                            <input type="file" name="photo_logo">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form1">Update Logo</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>

                            


                          </div>
                          <div class="tab-pane" id="tab_2">

                              <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Existing Photo</label>
                                        <div class="col-sm-6" style="padding-top:6px;">
                                            <img src="../assets/uploads/<?php echo $favicon?>" class="existing-photo" style="height:40px;">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">New Photo</label>
                                        <div class="col-sm-6" style="padding-top:6px;">
                                            <input type="file" name="photo_favicon">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form2">Update Favicon</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>
                          <div class="tab-pane" id="tab_3">

                            <form class="form-horizontal" action="" method="post">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Footer - About Us </label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" name="footer_about" id="editor1"><?php echo $footer_about?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Footer - Copyright </label>
                                        <div class="col-sm-9">
                                            <input class="form-control" type="text" name="footer_copyright" value="<?php echo $footer_copyright?>">
                                        </div>
                                    </div>                                
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Contact Address </label>
                                        <div class="col-sm-6">
                                            <textarea class="form-control" name="contact_address" style="height:140px;"><?php echo $contact_address?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Contact Email </label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="contact_email" value="<?php echo $contact_email?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Contact Phone Number </label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="contact_phone" value="<?php echo $contact_phone?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Contact Fax Number </label>
                                        <div class="col-sm-6">
                                            <input type="text" class="form-control" name="contact_fax" value="<?php echo $contact_fax?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Contact Map iFrame </label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" name="contact_map_iframe" style="height:200px;"><?php echo $contact_map_iframe?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form3">Update Footer</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>

                          <div class="tab-pane" id="tab_4">

                              <form class="form-horizontal" action="" method="post">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Email Address <span>*</span></label>
                                        <div class="col-sm-4">
                                            <input type="text" class="form-control" name="receive_email" value="<?php echo $receive_email?>">
                                        </div>
                                    </div>                                    
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Email Subject <span>*</span></label>
                                        <div class="col-sm-9">
                                            <input type="text" class="form-control" name="receive_email_subject" value="<?php echo $receive_email_subject?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Thank you message <span>*</span></label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" name="receive_email_thank_you_message"><?php echo $receive_email_thank_you_message?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form4">Update</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>

                          <div class="tab-pane" id="tab_5">

                              <form class="form-horizontal" action="" method="post">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">How many recent news? <span>*</span></label>
                                        <div class="col-sm-4">
                                            <input type="text" class="form-control" name="total_recent_news" value="<?php echo $total_recent_news?>">
                                            If you do not want to show recent news, put value to 0
                                        </div>
                                    </div>        
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">How many popular news? <span>*</span></label>
                                        <div class="col-sm-4">
                                            <input type="text" class="form-control" name="total_popular_news" value="<?php echo $total_popular_news?>">
                                            If you do not want to show popular news, put value to 0
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form5">Update</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>


                          <div class="tab-pane" id="tab_6">

                              <form class="form-horizontal" action="" method="post">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Meta Title </label>
                                        <div class="col-sm-9">
                                            <input type="text" name="meta_title_home" class="form-control" value="<?php echo $meta_title_home ?>">
                                        </div>
                                    </div>        
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Meta Keyword </label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" name="meta_keyword_home" style="height:100px;"><?php echo $meta_keyword_home ?></textarea>
                                        </div>
                                    </div>    
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Meta Description </label>
                                        <div class="col-sm-9">
                                            <textarea class="form-control" name="meta_description_home" style="height:200px;"><?php echo $meta_description_home ?></textarea>
                                        </div>
                                    </div>    
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form6">Update</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>


                          <div class="tab-pane" id="tab_7">

                              <form class="form-horizontal" action="" method="post">
                            <div class="box box-info">
                                <div class="box-body">
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label">Mode Rewrite </label>
                                        <div class="col-sm-4">
                                            <select name="mod_rewrite" class="form-control" style="width:auto;">
                                                <option value="Off" <?php if($mod_rewrite == 'Off'){echo 'selected';} ?>>Off</option>
                                                <option value="On" <?php if($mod_rewrite == 'On'){echo 'selected';} ?>>On</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="" class="col-sm-2 control-label"></label>
                                        <div class="col-sm-6">
                                            <button type="submit" class="btn btn-success pull-left" name="form7">Update</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>


                          </div>


                      </div>
                </div>

                

            </form>
        </div>
    </div>

</section>

<?php require_once('footer.php'); ?>
Онлайн: 2
Реклама