Example #1
0
<?php

//Lets just save admin settings so we can move forward
$uid = 1;
$pass = pass_code(post('password'));
$db->update(tbl("users"), array('username', 'password', 'email', 'doj', 'num_visits', 'ip', 'signup_ip', 'background_color', 'total_groups', 'banned_users'), array(post('username'), $pass, post('email'), now(), 1, $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_ADDR'], '', 0, ''), "userid='{$uid}'");
//Login user
$userquery->login_user(post('username'), post('password'));
echo msg_arr(array('msg' => 'Admin details have been updated'));
?>
<h2>Website basic configurations</h2>
here you can set basic configuration of your website, you can change them later by going to Admin area &gt; Website Configurations

<p>


<form name="installation" method="post" id="installation">
    
    <div class="field">
    <label for="title">Website title</label>
    <input name="title" type="text" id="title" class="br5px" value="Clipbucket v3">
    </div>
    
    <div class="field">
    <label for="slogan">Website Slogan</label>
    <input name="slogan" type="text" id="slogan" class="br5px" value="A way to broadcast yourself">
    </div>
    
    <div class="field">
    <label for="baseurl">Website URL</label>
    <input name="baseurl" type="text" id="baseurl" class="br5px" value="<?php 
Example #2
0
<?php

/**
 * File used to change admin password manually
 * Usage : change username and password in from their default values
 * to your account username and your password, upload this file on your
 * root directory of clipbucket where index.php is found so e.g http://clipbucket.com/admin_change_pass.php
 * you will see a confirmation message that your account password has been changed.
 *
 * for help and support pelase visti forums.clip-bucket.com or report issues on code.google.com/p/clipbucket/issues
 */
include "includes/config.inc.php";
//Username of account you want to changge password
$username = '******';
//Set password
$password = '******';
// -- DO NOT GO INSIDE DEEP RED PHP -- //
$user = $userquery->get_user_details($username);
if (!$user) {
    e("User does not exist");
} else {
    $pass = pass_code($password);
    $db->update(tbl('users'), array('password'), array($pass), "username='******'");
    e("Password for your account has been changed, please delete this file", "m");
}
display_it();
Example #3
0
 /**
  * Function used to update use details
  */
 function update_user($array)
 {
     global $LANG, $db, $signup, $Upload;
     if ($array == NULL) {
         $array = $_POST;
     }
     if (is_array($_FILES)) {
         $array = array_merge($array, $_FILES);
     }
     $userfields = $this->load_profile_fields($array);
     //$signup_fields = $this->load_signup_fields($array);
     $custom_signup_fields = $this->load_custom_signup_fields($array);
     //Adding Custom Form Fields
     if (count($this->custom_profile_fields) > 0) {
         $userfields = array_merge($userfields, $this->custom_profile_fields);
     }
     //Adding custom fields from group
     if (count($this->custom_profile_fields_groups) > 0) {
         $custom_fields_from_group_fields = array();
         $custom_fields_from_group = $this->custom_profile_fields_groups;
         foreach ($custom_fields_from_group as $cffg) {
             $custom_fields_from_group_fields = array_merge($custom_fields_from_group_fields, $cffg['fields']);
         }
         $userfields = array_merge($userfields, $custom_fields_from_group_fields);
     }
     validate_cb_form($custom_signup_fields, $array);
     validate_cb_form($userfields, $array);
     foreach ($userfields as $field) {
         $name = formObj::rmBrackets($field['name']);
         $val = $array[$name];
         if ($field['use_func_val']) {
             $val = $field['validate_function']($val);
         }
         //Overrides use_func_val
         if ($field['value_function'] && function_exists($field['value_function'])) {
             $val = $field['value_function']($val);
         }
         if (!empty($field['db_field'])) {
             $query_field[] = $field['db_field'];
         }
         if (is_array($val)) {
             $new_val = '';
             foreach ($val as $v) {
                 $new_val .= "#" . $v . "# ";
             }
             $val = $new_val;
         }
         if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) {
             $val = mysql_clean($val);
         } else {
             $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
         }
         if (!empty($field['db_field'])) {
             $query_val[] = $val;
         }
     }
     //Category
     if ($cat_field) {
         $field = $cat_field;
         $name = formObj::rmBrackets($field['name']);
         $val = $array[$name];
         if ($field['use_func_val']) {
             $val = $field['validate_function']($val);
         }
         if (!empty($field['db_field'])) {
             $uquery_field[] = $field['db_field'];
         }
         if (is_array($val)) {
             $new_val = '';
             foreach ($val as $v) {
                 $new_val .= "#" . $v . "# ";
             }
             $val = $new_val;
         }
         if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) {
             $val = mysql_clean($val);
         } else {
             $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
         }
         if (!empty($field['db_field'])) {
             $uquery_val[] = $val;
         }
     }
     //updating user detail
     if (has_access('admin_access', TRUE) && isset($array['admin_manager'])) {
         //Checking Username
         if (empty($array['username'])) {
             e(lang('usr_uname_err'));
         } elseif ($array['dusername'] != $array['username'] && $this->username_exists($array['username'])) {
             e(lang('usr_uname_err2'));
         } elseif (!username_check($array['username'])) {
             e(lang('usr_uname_err3'));
         } else {
             $username = $array['username'];
         }
         //Checking Email
         if (empty($array['email'])) {
             e(lang('usr_email_err1'));
         } elseif (!is_valid_syntax('email', $array['email'])) {
             e(lang('usr_email_err2'));
         } elseif (email_exists($array['email']) && $array['email'] != $array['demail']) {
             e(lang('usr_email_err3'));
         } else {
             $email = $array['email'];
         }
         $uquery_field[] = 'username';
         $uquery_val[] = $username;
         $uquery_field[] = 'email';
         $uquery_val[] = $email;
         //Changning Password
         if (!empty($array['pass'])) {
             if ($array['pass'] != $array['cpass']) {
                 e(lang("pass_mismatched"));
             } else {
                 $pass = pass_code($array['pass']);
             }
             $uquery_field[] = 'password';
             $uquery_val[] = $pass;
         }
         //Changing User Level
         $uquery_field[] = 'level';
         $uquery_val[] = $array['level'];
         //Checking for user stats
         $uquery_field[] = 'profile_hits';
         $uquery_val[] = $array['profile_hits'];
         $uquery_field[] = 'total_watched';
         $uquery_val[] = $array['total_watched'];
         $uquery_field[] = 'total_videos';
         $uquery_val[] = $array['total_videos'];
         $uquery_field[] = 'total_comments';
         $uquery_val[] = $array['total_comments'];
         $uquery_field[] = 'subscribers';
         $uquery_val[] = $array['subscribers'];
         $uquery_field[] = 'comments_count';
         $uquery_val[] = $array['comments_count'];
         $query_field[] = 'rating';
         $rating = $array['rating'];
         if ($rating < 1 || $rating > 10) {
             $rating = 1;
         }
         $query_val[] = $rating;
         $query_field[] = 'rated_by';
         $query_val[] = $array['rated_by'];
         //Changing JOined Date
         if (isset($array['doj'])) {
             $uquery_field[] = 'doj';
             $uquery_val[] = $array['doj'];
         }
     }
     //Changing Gender
     if ($array['sex']) {
         $uquery_field[] = 'sex';
         $uquery_val[] = mysql_clean($array['sex']);
     }
     //Changing Country
     if ($array['country']) {
         $uquery_field[] = 'country';
         $uquery_val[] = mysql_clean($array['country']);
     }
     //Changing Date of birth
     if (isset($array['dob'])) {
         $uquery_field[] = 'dob';
         $uquery_val[] = $array['dob'];
     }
     //Changing category
     if (isset($array['category'])) {
         $uquery_field[] = 'category';
         $uquery_val[] = $array['category'];
     }
     //Updating User Avatar
     if ($array['avatar_url']) {
         $uquery_field[] = 'avatar_url';
         $uquery_val[] = $array['avatar_url'];
     }
     if ($array['remove_avatar_url'] == 'yes') {
         $uquery_field[] = 'avatar_url';
         $uquery_val[] = '';
     }
     //Deleting User Avatar
     if ($array['delete_avatar'] == 'yes') {
         $file = USER_THUMBS_DIR . '/' . $array['avatar_file_name'];
         if (file_exists($file) && $array['avatar_file_name'] != '') {
             unlink($file);
         }
     }
     //Deleting User Bg
     if ($array['delete_bg'] == 'yes') {
         $file = USER_BG_DIR . '/' . $array['bg_file_name'];
         if (file_exists($file) && $array['bg_file_name']) {
             unlink($file);
         }
     }
     if (isset($_FILES['avatar_file']['name'])) {
         $file = $Upload->upload_user_file('a', $_FILES['avatar_file'], $array['userid']);
         if ($file) {
             $uquery_field[] = 'avatar';
             $uquery_val[] = $file;
         }
     }
     //Updating User Background
     if ($array['background_url']) {
         $uquery_field[] = 'background_url';
         $uquery_val[] = $array['background_url'];
     }
     if ($array['background_color']) {
         $uquery_field[] = 'background_color';
         $uquery_val[] = $array['background_color'];
     }
     if ($array['background_repeat']) {
         $uquery_field[] = 'background_repeat';
         $uquery_val[] = $array['background_repeat'];
     }
     if (isset($_FILES['background_file']['name'])) {
         $file = $Upload->upload_user_file('b', $_FILES['background_file'], $array['userid']);
         if ($file) {
             $uquery_field[] = 'background';
             $uquery_val[] = $file;
         }
     }
     //Adding Custom Field
     if (is_array($custom_signup_fields)) {
         foreach ($custom_signup_fields as $field) {
             $name = formObj::rmBrackets($field['name']);
             $val = $array[$name];
             if ($field['use_func_val']) {
                 $val = $field['validate_function']($val);
             }
             if (!empty($field['db_field'])) {
                 $uquery_field[] = $field['db_field'];
             }
             if (is_array($val)) {
                 $new_val = '';
                 foreach ($val as $v) {
                     $new_val .= "#" . $v . "# ";
                 }
                 $val = $new_val;
             }
             if (!$field['clean_func'] || !function_exists($field['clean_func']) && !is_array($field['clean_func'])) {
                 $val = mysql_clean($val);
             } else {
                 $val = apply_func($field['clean_func'], sql_free('|no_mc|' . $val));
             }
             if (!empty($field['db_field'])) {
                 $uquery_val[] = $val;
             }
         }
     }
     if (!error() && is_array($uquery_field)) {
         $db->update(tbl($this->dbtbl['users']), $uquery_field, $uquery_val, " userid='" . mysql_clean($array['userid']) . "'");
         e(lang("usr_upd_succ_msg"), 'm');
     }
     //updating user profile
     if (!error()) {
         $log_array = array('success' => 'yes', 'details' => "updated profile");
         //Login Upload
         insert_log('profile_update', $log_array);
         $db->update(tbl($this->dbtbl['user_profile']), $query_field, $query_val, " userid='" . mysql_clean($array['userid']) . "'");
         e(lang("usr_pof_upd_msg"), 'm');
     }
 }